类 HostInfo

  • 所有已实现的接口:
    DatabaseUrlContainer

    public class HostInfo
    extends Object
    implements DatabaseUrlContainer
    This class holds the following MySQL host information:
    • host: an IP or host name.
    • port: the port number or 0 if not known.
    • user: the user name.
    • password: the password.
    • host properties: host specific connection arguments.
    • 字段详细资料

    • 构造器详细资料

      • HostInfo

        public HostInfo()
        Constructs an empty HostInfo instance.
      • HostInfo

        public HostInfo​(DatabaseUrlContainer url,
                        String host,
                        int port,
                        String user,
                        String password)
        Constructs a HostInfo instance initialized with the provided host, port and user info.
        参数:
        url - a reference to the original database URL that produced this host info
        host - the host ip or name
        port - the port
        user - the user name
        password - the user's password
      • HostInfo

        public HostInfo​(DatabaseUrlContainer url,
                        String host,
                        int port,
                        String user,
                        String password,
                        Map<String,​String> properties)
        Constructs a HostInfo instance initialized with the provided host, port, user, password and connection arguments.
        参数:
        url - a reference to the original database URL that produced this host info
        host - the host ip or name
        port - the port
        user - the user name
        password - this user's password
        properties - a connection arguments map.
    • 方法详细资料

      • getHost

        public String getHost()
        Returns the host.
        返回:
        the host
      • getPort

        public int getPort()
        Returns the port.
        返回:
        the port
      • getHostPortPair

        public String getHostPortPair()
        Returns a host:port representation of this host.
        返回:
        the host:port representation of this host
      • getUser

        public String getUser()
        Returns the user name.
        返回:
        the user name
      • getPassword

        public String getPassword()
        Returns the password.
        返回:
        the password
      • getHostProperties

        public Map<String,​String> getHostProperties()
        Returns the properties specific to this host.
        返回:
        this host specific properties
      • getProperty

        public String getProperty​(String key)
        Returns the connection argument for the given key.
        参数:
        key - key
        返回:
        the connection argument for the given key
      • getDatabase

        public String getDatabase()
        Shortcut to the database connection argument.
        返回:
        the database name
      • exposeAsProperties

        public Properties exposeAsProperties()
        Exposes this host info as a single properties instance. The values for host, port, user and password are added to the properties map with their standard keys.
        返回:
        a Properties instance containing the full host information.
      • getDatabaseUrl

        public String getDatabaseUrl()
        Returns the original database URL that produced this host info.
        指定者:
        getDatabaseUrl 在接口中 DatabaseUrlContainer
        返回:
        the original database URL
      • equalHostPortPair

        public boolean equalHostPortPair​(HostInfo hi)
        Checks if this HostInfo has the same host and port pair as the given HostInfo.
        参数:
        hi - the HostInfo to compare with.
        返回:
        true if both objects have equal host and port pairs, false otherwise.
      • toString

        public String toString()
        Returns a string representation of this object.
        覆盖:
        toString 在类中 Object
        返回:
        a string representation of this object