Annotation Type 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.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      int max  
      java.lang.String message  
      int min  
    • Field Detail

      • DEFAULT_MESSAGE

        static final java.lang.String DEFAULT_MESSAGE
      • MIN_VALUE

        static final int MIN_VALUE
      • MAX_VALUE

        static final int MAX_VALUE
    • Element Detail

      • 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

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