public class DigitsValidatorForString extends Object implements ConstraintValidator<Digits,String>
String being validated consists of digits,
and matches the pattern defined in the constraint.| Constructor and Description |
|---|
DigitsValidatorForString() |
| Modifier and Type | Method and Description |
|---|---|
void |
initialize(Digits constraintAnnotation)
Initialize the validator in preparation for isValid calls.
|
boolean |
isValid(String str,
ConstraintValidatorContext constraintValidatorContext)
Implement the validation logic.
|
public void initialize(Digits constraintAnnotation)
ConstraintValidatorinitialize in interface ConstraintValidator<Digits,String>constraintAnnotation - annotation instance for a given constraint declarationpublic boolean isValid(String str, ConstraintValidatorContext constraintValidatorContext)
ConstraintValidatorvalue must not be altered.
This method can be accessed concurrently, thread-safety must be ensured
by the implementation.isValid in interface ConstraintValidator<Digits,String>str - object to validateconstraintValidatorContext - context in which the constraint is evaluatedvalue does not pass the constraintCopyright © 2012 JBoss by Red Hat. All Rights Reserved.