java.lang.Object
java.lang.Enum<PortType>
com.github.rvesse.airline.annotations.restrictions.PortType
All Implemented Interfaces:
PortRange, Serializable, Comparable<PortType>, Constable

public enum PortType extends Enum<PortType> implements PortRange
Port types
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Any port
    The dynamic ports (aka private or ephemeral ports), these are ports 49152 to 65535 which are never assigned by the IANA
    Port 0 i.e.
    The system (aka well known or privileged ports), these are ports 1 to 1023 and usually require adminstrative privileges
    The user ports (aka registered ports), these are ports 1024 to 49151 and which may be registered and assigned by the IANA
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
     
    private final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    PortType(int min, int max)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets whether the port range contains another port range i.e.
    int
    Gets the maximum port
    int
    Gets the minimum port
    boolean
    inRange(int port)
    Gets whether a port falls within the range
    static String
    toRangesString(Set<PortRange> acceptablePorts)
    Gets a string denoting all the acceptable port ranges
     
    static PortType
    Returns the enum constant of this class with the specified name.
    static PortType[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ANY

      public static final PortType ANY
      Any port
    • OS_ALLOCATED

      public static final PortType OS_ALLOCATED
      Port 0 i.e. the special port that has the OS allocate an available port
    • SYSTEM

      public static final PortType SYSTEM
      The system (aka well known or privileged ports), these are ports 1 to 1023 and usually require adminstrative privileges
    • USER

      public static final PortType USER
      The user ports (aka registered ports), these are ports 1024 to 49151 and which may be registered and assigned by the IANA
    • DYNAMIC

      public static final PortType DYNAMIC
      The dynamic ports (aka private or ephemeral ports), these are ports 49152 to 65535 which are never assigned by the IANA
  • Field Details

    • min

      private final int min
    • max

      private final int max
  • Constructor Details

    • PortType

      private PortType(int min, int max)
  • Method Details

    • values

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

      public static PortType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • getMinimumPort

      public int getMinimumPort()
      Description copied from interface: PortRange
      Gets the minimum port
      Specified by:
      getMinimumPort in interface PortRange
      Returns:
      Minimum port
    • getMaximumPort

      public int getMaximumPort()
      Description copied from interface: PortRange
      Gets the maximum port
      Specified by:
      getMaximumPort in interface PortRange
      Returns:
      Maximum port
    • inRange

      public boolean inRange(int port)
      Description copied from interface: PortRange
      Gets whether a port falls within the range
      Specified by:
      inRange in interface PortRange
      Parameters:
      port - Port
      Returns:
      True if in range, false otherwise
    • contains

      public boolean contains(PortRange other)
      Description copied from interface: PortRange
      Gets whether the port range contains another port range i.e. does this cover at least the same range of ports as the other
      Specified by:
      contains in interface PortRange
      Parameters:
      other - Other port type
      Returns:
      True if this covers at least the same range of ports as the other, false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Enum<PortType>
    • toRangesString

      public static String toRangesString(Set<PortRange> acceptablePorts)
      Gets a string denoting all the acceptable port ranges
      Parameters:
      acceptablePorts - Port types
      Returns:
      String detailing acceptable ranges