org.dellroad.stuff.validation
Class AbstractValidator<C extends Annotation,T>
java.lang.Object
org.dellroad.stuff.validation.AbstractValidator<C,T>
- All Implemented Interfaces:
- ConstraintValidator<C,T>
- Direct Known Subclasses:
- PatternValidator, SelfValidatingValidator, SortedValidator
public abstract class AbstractValidator<C extends Annotation,T>
- extends Object
- implements ConstraintValidator<C,T>
Support superclass for validators.
|
Field Summary |
protected C |
annotation
The constraint being checked by this instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
annotation
protected C extends Annotation annotation
- The constraint being checked by this instance.
AbstractValidator
public AbstractValidator()
initialize
public void initialize(C annotation)
- Specified by:
initialize in interface ConstraintValidator<C extends Annotation,T>
setViolation
protected void setViolation(ConstraintValidatorContext context,
String message)
- Convenience method to add a constraint violation described by
message and disable the default violation.
isCollectionValid
protected boolean isCollectionValid(Collection<? extends T> collection,
ConstraintValidatorContext context)
- Apply this constraint to all values in a collection. This is a convenience method for validators
that want to work with both simple properties and collection properties.