Class Port

java.lang.Object
com.mastfrog.url.Port
All Implemented Interfaces:
URLComponent, Serializable

public final class Port extends Object implements URLComponent
A TCP port. Represents the optional port portion of a URL, such as https://www.timboudreau.com:8443/management/
Author:
Tim Boudreau
See Also:
  • Constructor Details

    • Port

      public Port(int port)
    • Port

      public Port(String port)
  • Method Details

    • intValue

      public int intValue()
      Get the integer value of this port
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isValid

      public boolean isValid()
      Determine if this is a valid port according to specification (i.e. port is non-negative and value is between 1 and 65535).
      Specified by:
      isValid in interface URLComponent
      Returns:
    • getComponentName

      public String getComponentName()
      Description copied from interface: URLComponent
      Get a human-readable, localized name for this part of the URL. Useful if an error message needs to be shown.
      Specified by:
      getComponentName in interface URLComponent
      Returns:
      The component name
    • appendTo

      public void appendTo(StringBuilder sb)
      Description copied from interface: URLComponent
      Append this component to a StringBuilder.
      Specified by:
      appendTo in interface URLComponent
      Parameters:
      sb - A StringBuilder
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object