Limits the length of the annotated element to predefined boundaries
Javadoc Ref :
@Length
Input Types 1 |
Object |
Output Types |
Object |
1Automatic conversion will take place if the provided input does not match any of the input classes, as described in the conversions part of the manual.
min |
Minimum allowable length. Default is 0 |
max |
Maximum allowable length. Default is Long.MAX_VALUE; |
message |
Literal message to use if validation fails. |
errorCode |
Error code to use if validation fails. |
messageKey |
Message key to use if validation fails. |
@Length(min=10)
private String minLength;
@Length(max=20)
private String maxLength;
@Length(min=10,max=20)
private String minMaxLength;