Annotation Type Length


@Target(FIELD) @Retention(RUNTIME) public @interface Length
Annotation used to validate the length of a string with specified minimum and maximum values. For custom or stricter length controls, consider using the Pattern annotation instead. * Example usage: *
  * 
  * public class UserDto {
  *     @Length(min=8, max=16)
  *     private String password;
  * }
  * 
  * 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
     
     
    int
     
  • Element Details

    • min

      int min
      Default:
      0
    • max

      int max
      Default:
      2147483647
    • message

      String message
      Default:
      "Field value must fit the length!"