Class Authority

  • All Implemented Interfaces:
    Serializable, Comparable<Authority>

    public class Authority
    extends Object
    implements Serializable, Comparable<Authority>
    A class representing the authority component of a URI reference.

    This class provides the parse(String) method, which parses a given string as an authority component, according to RFC 3986. If parsing succeeds, it creates an Authority object. If parsing fails due to invalid input, it throws an IllegalArgumentException. Individual components of the authority, such as userinfo, can be accessed through corresponding getter methods, such as getUserinfo().

    This class is immutable.

    Author:
    Hideki Ikeda
    See Also:
    RFC 3986, 3.2. Authority, Serialized Form
    • Method Detail

      • getUserinfo

        public String getUserinfo()
        Get the value of the userinfo component of this Authority object.
        Returns:
        The value of the userinfo component of this Authority object.
      • getHost

        public Host getHost()
        Get the value of the host component of this Authority object.
        Returns:
        The value of the host component of this Authority object.
      • getPort

        public int getPort()
        Get the value of the port component of this Authority object.
        Returns:
        The value of the port component of this Authority object.
      • toString

        public String toString()
        Returns a string representation of this Authority object. The string is constructed by concatenating the userinfo, host, and port components.
        Overrides:
        toString in class Object
        Returns:
        The string representation of this Authority object.
      • equals

        public boolean equals​(Object obj)
        Compares this Authority object with the specified object for equality. The comparison is based on the values of userinfo, host, and port components.
        Overrides:
        equals in class Object
        Parameters:
        obj - The object to be compared for equality with this Authority object.
        Returns:
        true if the specified object is equal to this Authority object.
      • hashCode

        public int hashCode()
        Returns the hash code value for this Authority object. The hash code is generated based on the values of userinfo, host, and port components.
        Overrides:
        hashCode in class Object
        Returns:
        The hash code value for this object.