public class SizeValidatorForMap extends Object implements ConstraintValidator<Size,Map>
Constructor and Description |
---|
SizeValidatorForMap() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(Size parameters)
Initializes the validator in preparation for
ConstraintValidator.isValid(Object, ConstraintValidatorContext) calls. |
boolean |
isValid(Map map,
ConstraintValidatorContext constraintValidatorContext)
Checks the number of entries in a map.
|
public void initialize(Size parameters)
ConstraintValidator
ConstraintValidator.isValid(Object, ConstraintValidatorContext)
calls.
The constraint annotation for a given constraint declaration
is passed.
This method is guaranteed to be called before any use of this instance for validation.
The default implementation is a no-op.
initialize
in interface ConstraintValidator<Size,Map>
parameters
- annotation instance for a given constraint declarationpublic boolean isValid(Map map, ConstraintValidatorContext constraintValidatorContext)
isValid
in interface ConstraintValidator<Size,Map>
map
- The map to validate.constraintValidatorContext
- context in which the constraint is evaluated.true
if the map is null
or the number of entries in map
is between the specified min
and max
values (inclusive),
false
otherwise.Copyright © 2019 JBoss by Red Hat. All rights reserved.