public abstract class AbstractDecimalMaxValidator<T> extends Object implements ConstraintValidator<DecimalMax,T>
Modifier and Type | Field and Description |
---|---|
protected BigDecimal |
maxValue |
Constructor and Description |
---|
AbstractDecimalMaxValidator() |
Modifier and Type | Method and Description |
---|---|
protected abstract int |
compare(T number) |
void |
initialize(DecimalMax maxValue)
Initializes the validator in preparation for
ConstraintValidator.isValid(Object, ConstraintValidatorContext) calls. |
boolean |
isValid(T value,
ConstraintValidatorContext constraintValidatorContext)
Implements the validation logic.
|
protected BigDecimal maxValue
public void initialize(DecimalMax 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<DecimalMax,T>
maxValue
- annotation instance for a given constraint declarationpublic boolean isValid(T value, ConstraintValidatorContext constraintValidatorContext)
ConstraintValidator
value
must not be altered.
This method can be accessed concurrently, thread-safety must be ensured by the implementation.
isValid
in interface ConstraintValidator<DecimalMax,T>
value
- object to validateconstraintValidatorContext
- context in which the constraint is evaluatedfalse
if value
does not pass the constraintprotected abstract int compare(T number)
Copyright © 2019 JBoss by Red Hat. All rights reserved.