Enum Protocols

java.lang.Object
java.lang.Enum<Protocols>
com.mastfrog.url.Protocols
All Implemented Interfaces:
Protocol, URLComponent, Serializable, Comparable<Protocols>, java.lang.constant.Constable

public enum Protocols extends Enum<Protocols> implements Protocol
Enum of standard URL protocols.
Author:
Tim Boudreau
  • Enum Constant Details

  • Method Details

    • values

      public static Protocols[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Protocols valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getName

      public String getName()
      Specified by:
      getName in interface Protocol
    • getDefaultPort

      public Port getDefaultPort()
      Specified by:
      getDefaultPort in interface Protocol
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in interface Protocol
    • match

      public boolean match(Protocol protocol)
    • match

      public boolean match(String protocol)
      Specified by:
      match in interface Protocol
    • isValid

      public boolean isValid()
      Description copied from interface: URLComponent
      Determine if this component is in compliance with the RFCs governing URLs and DNS.
      Specified by:
      isValid in interface URLComponent
      Returns:
      True if this component is valid.
    • forName

      public static Protocol forName(String name)
    • isKnownProtocol

      public boolean isKnownProtocol()
      Specified by:
      isKnownProtocol in interface Protocol
    • 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
    • isNetworkProtocol

      public boolean isNetworkProtocol()
      Specified by:
      isNetworkProtocol in interface Protocol
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Protocols>
    • isSecureVersionOf

      public boolean isSecureVersionOf(Protocol other)
      Specified by:
      isSecureVersionOf in interface Protocol
    • isInsecureVersionOf

      public boolean isInsecureVersionOf(Protocol other)
      Specified by:
      isInsecureVersionOf in interface Protocol