Class Host

  • All Implemented Interfaces:
    java.io.Serializable, NamedEndpoint

    @Contract(threading=IMMUTABLE)
    public final class Host
    extends java.lang.Object
    implements NamedEndpoint, java.io.Serializable
    Component that holds all details needed to describe a network connection to a host. This includes remote host name and port.
    Since:
    5.0
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Host​(java.lang.String name, int port)
      Constructs a new instance.
    • Constructor Detail

      • Host

        public Host​(java.lang.String name,
                    int port)
        Constructs a new instance.
        Parameters:
        name - The host name, not null.
        port - The port value, between 0 and 65535, inclusive. -1 indicates the scheme default port.
        Throws:
        java.lang.NullPointerException - if the name is null.
        java.lang.IllegalArgumentException - If the port parameter is outside the specified range of valid port values, which is between 0 and 65535, inclusive. -1 indicates the scheme default port.
    • Method Detail

      • create

        public static Host create​(java.lang.String s)
                           throws java.net.URISyntaxException
        Throws:
        java.net.URISyntaxException
      • getHostName

        public java.lang.String getHostName()
        Description copied from interface: NamedEndpoint
        Returns name (IP or DNS name).
        Specified by:
        getHostName in interface NamedEndpoint
        Returns:
        the host name (IP or DNS name)
      • getPort

        public int getPort()
        Description copied from interface: NamedEndpoint
        Returns the port.
        Specified by:
        getPort in interface NamedEndpoint
        Returns:
        the host port, or -1 if not set
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object