public class DigitsValidatorForNumber extends Object implements ConstraintValidator<Digits,Number>
Number
being validates matches the pattern
defined in the constraint.Constructor and Description |
---|
DigitsValidatorForNumber() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(Digits constraintAnnotation)
Initialize the validator in preparation for isValid calls.
|
boolean |
isValid(Number num,
ConstraintValidatorContext constraintValidatorContext)
Implement the validation logic.
|
public void initialize(Digits constraintAnnotation)
ConstraintValidator
initialize
in interface ConstraintValidator<Digits,Number>
constraintAnnotation
- annotation instance for a given constraint declarationpublic boolean isValid(Number num, 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<Digits,Number>
num
- object to validateconstraintValidatorContext
- context in which the constraint is evaluatedvalue
does not pass the constraintCopyright © 2018 JBoss by Red Hat. All rights reserved.