Class HostAndPort

    • Field Detail

      • log

        protected static org.slf4j.Logger log
      • localhost

        public static volatile String localhost
    • Constructor Detail

      • HostAndPort

        public HostAndPort​(String host,
                           int port)
    • Method Detail

      • getHost

        public String getHost()
      • getPort

        public int getPort()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • from

        public static HostAndPort from​(String string)
        Creates HostAndPort with unconverted host.
        Parameters:
        string - String to parse. Must be in "host:port" format. Port is mandatory.
        Returns:
        parsed HostAndPort
      • extractParts

        public static String[] extractParts​(String from)
        Splits String into host and port parts. String must be in ( host + ":" + port ) format. Port is optional
        Parameters:
        from - String to parse
        Returns:
        array of host and port strings
      • parseString

        public static HostAndPort parseString​(String from)
        Creates HostAndPort instance from string. String must be in ( host + ":" + port ) format. Port is mandatory. Can convert host part.
        Parameters:
        from - String to parse
        Returns:
        HostAndPort instance
        See Also:
        convertHost(String)
      • convertHost

        public static String convertHost​(String host)
      • setLocalhost

        public static void setLocalhost​(String localhost)
      • getLocalhost

        public static String getLocalhost()
        This method resolves the localhost in a 'lazy manner'.
        Returns:
        localhost
      • getLocalHostQuietly

        public static String getLocalHostQuietly()