Annotation Type Ipv4AndPort


  • @Documented
    @Constraint(validatedBy=Ipv4AndPortValidator.class)
    @Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE})
    @Retention(RUNTIME)
    public @interface Ipv4AndPort
    The annotated element must have the form ipv4-address:port. For example 192.168.1.150:8888 is valid while 192.168.1.150 (without port) and 1111.1111.1.150:8009 (two many digits in octets) are not. Also, as the name indicates, this only supports IPv4 addresses.
    Implementation Note:
    Currently the validation only verifies that the IP is in "dotted-quad" syntax followed by a colon and a port. It only validates that each dotted-quad and port are numbers, and does not validate the values are within valid ranges (i.e. it does not check each segment is in the range 0-255 nor does it validate the port range).
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean allowNull
      Whether to consider null as valid.
      Class<?>[] groups  
      String message  
      Class<? extends javax.validation.Payload>[] payload  
    • Element Detail

      • message

        String message
        Default:
        "{org.kiwiproject.validation.Ipv4AndPort.message}"
      • groups

        Class<?>[] groups
        Default:
        {}
      • payload

        Class<? extends javax.validation.Payload>[] payload
        Default:
        {}
      • allowNull

        boolean allowNull
        Whether to consider null as valid. The default is false.
        Returns:
        true to consider null as valid
        Default:
        false