Annotation Interface Size


@Retention(RUNTIME) @Target(FIELD) public @interface Size
The annotated element size must be between the specified boundaries (included).

Supported types are:

  • STRING (length of string is evaluated)
  • SET_OF_STRING (set size is evaluated)
  • SET_OF_CI (set size is evaluated)
  • LIST_OF_STRING (list size is evaluated)
  • LIST_OF_CI (list size is evaluated)
  • MAP_STRING_STRING (map size is evaluated)

null elements are considered valid.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
     
     
    int
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final int
     
    static final int
     
  • Field Details

  • Element Details

    • min

      int min
      Returns:
      size the element must be higher or equal to
      Default:
      0
    • max

      int max
      Returns:
      size the element must be lower or equal to
      Default:
      2147483647
    • message

      String message
      Default:
      "The size must be between %s and %s"