Annotation Interface SizeConstraint


@Retention(RUNTIME) @Target({METHOD,TYPE_USE}) public @interface SizeConstraint
Constrains a configuration element's size.

The SizeConstraint may be used to annotate any configuration element that has a size, such as a List<?> or String.

Note: to constrain the size of the strings in a List<String>, rather than the size of the list itself, annotate the list's type parameter as follows: List<@SizeConstraint String>.

To constrain the size of an optional string, annotate the optional's type parameter as follows: Optional<@SizeConstraint String>.

  • Optional Element Summary

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

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

  • Element Details

    • min

      int min
      Returns:
      minimum allowed size for the annotated element.
      Default:
      0
    • max

      int max
      Returns:
      maximum allowed size for the annotated element.
      Default:
      2147483647