Annotation Type TCPPort


@Documented
@Retention(RUNTIME)
@Target({METHOD,FIELD,PARAMETER,TYPE_USE})
@Constraint(validatedBy=Validator.class)
public @interface TCPPort
Validates that a number looks like a TCP port. Always accepts null.
Author:
Donal Fellows
See Also:
UDPPort
  • Field Summary

    Fields 
    Modifier and Type Fields Description
    static int MAX_TCP_PORT
    The maximum TCP port number.
    static int MIN_TCP_PORT
    The minimum ordinary TCP port number.
  • Optional Element Summary

    Optional Elements 
    Modifier and Type Optional Element Description
    boolean any
    Whether to allow the "any" port.
    boolean ephemeral
    Whether to allow ephemeral ports.
    String message
    Message on constraint violated.
    boolean system
    Whether to allow system ports.
  • Field Details

    • MIN_TCP_PORT

      static final int MIN_TCP_PORT
      The minimum ordinary TCP port number.
    • MAX_TCP_PORT

      static final int MAX_TCP_PORT
      The maximum TCP port number.
  • Element Details

    • any

      boolean any
      Whether to allow the "any" port. Note that this is not the same as allowing any other port; it's more that it isn't bound to a specific port.
      Returns:
      Whether 0 is allowed.
      Default:
      false
    • system

      boolean system
      Whether to allow system ports.
      Returns:
      Whether 1-1023 is allowed.
      Default:
      false
    • ephemeral

      boolean ephemeral
      Whether to allow ephemeral ports.
      Returns:
      Whether 32768-65535 is allowed
      Default:
      true
    • message

      String message
      Message on constraint violated.
      Returns:
      Message
      Default:
      "${validatedValue} is a bad TCP port"