public class SizeValidator extends Object implements AttributeValidator
Is capable of validating the sizes of CharSequences, Collections, Maps, and arrays.
| Constructor and Description |
|---|
SizeValidator(long min,
long max)
Creates a
SizeValidator with an inclusive range (i.e., [min, max]). |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int |
hashCode() |
Optional<AttributeValidationReport> |
validate(Attribute attribute)
Validates a single
Attribute. |
public SizeValidator(long min,
long max)
SizeValidator with an inclusive range (i.e., [min, max]).
The minimum must be non-negative and the maximum must be greater than or equal to the minimum.
min - the minimum allowable size (inclusive), must be non-negativemax - the maximum allowable size (inclusive), must be greater than or equal to minIllegalArgumentException - if 0 <= min <= max does not holdpublic Optional<AttributeValidationReport> validate(Attribute attribute)
Attribute.
Validates only the values of attribute that are CharSequences, Collections, Maps, or arrays.
validate in interface AttributeValidatorattribute - the Attribute to validate, cannot be nullOptional containing an AttributeValidationReport if there are
violations, or an empty Optional if there are no violationsThis work is licensed under a Creative Commons Attribution 4.0 International License.