public class MaxValidatorForMonetaryAmount extends Object implements ConstraintValidator<Max,MonetaryAmount>
Constructor and Description |
---|
MaxValidatorForMonetaryAmount() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(Max maxValue)
Initializes the validator in preparation for
ConstraintValidator.isValid(Object, ConstraintValidatorContext) calls. |
boolean |
isValid(MonetaryAmount value,
ConstraintValidatorContext context)
Implements the validation logic.
|
public void initialize(Max maxValue)
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<Max,MonetaryAmount>
maxValue
- annotation instance for a given constraint declarationpublic boolean isValid(MonetaryAmount value, ConstraintValidatorContext context)
ConstraintValidator
value
must not be altered.
This method can be accessed concurrently, thread-safety must be ensured by the implementation.
isValid
in interface ConstraintValidator<Max,MonetaryAmount>
value
- object to validatecontext
- context in which the constraint is evaluatedfalse
if value
does not pass the constraintCopyright © 2021 JBoss by Red Hat. All rights reserved.