public class CommonEachValidator extends Object implements javax.validation.ConstraintValidator<Annotation,Collection<?>>
| Constructor and Description |
|---|
CommonEachValidator() |
| Modifier and Type | Method and Description |
|---|---|
protected <T extends javax.validation.ConstraintValidator<?,?>> |
categorizeValidatorsByType(List<Class<? extends T>> validatorClasses) |
protected <T extends Annotation> |
createConstraintAndCopyAttributes(Class<T> constraintType,
Annotation source)
Instantiates constraint of the specified type and copies values of all
the common attributes from the given source constraint (of any type)
to it.
|
protected javax.validation.metadata.ConstraintDescriptor |
createConstraintDescriptor(Annotation constraint) |
protected String |
createInterpolatedMessage(javax.validation.metadata.ConstraintDescriptor descriptor,
Object value)
Reads and interpolates an error message for the given constraint and
value.
|
protected Class<?> |
determineTargetType(Class<? extends javax.validation.ConstraintValidator<?,?>> validatorClass) |
protected javax.validation.ConstraintValidator |
findAndInitializeValidator(Class<?> type) |
protected javax.validation.ConstraintValidator |
getAnyValidatorInstance()
Returns initialized validator instance for any object type.
|
protected javax.validation.ConstraintValidator |
getValidatorInstance(Class<?> type)
Returns initialized validator instance for the specified object type.
|
void |
initialize(Annotation eachAnnotation) |
boolean |
isValid(Collection<?> collection,
javax.validation.ConstraintValidatorContext context) |
protected boolean |
isWrapperAnnotation(Class<? extends Annotation> annotationType)
Whether the given annotation type contains the
value attribute
of the type that extends Annotation[]. |
void |
setValidatorFactory(javax.validation.ValidatorFactory factory) |
protected Annotation[] |
unwrapConstraints(Annotation wrapper) |
public void initialize(Annotation eachAnnotation)
initialize in interface javax.validation.ConstraintValidator<Annotation,Collection<?>>public boolean isValid(Collection<?> collection, javax.validation.ConstraintValidatorContext context)
isValid in interface javax.validation.ConstraintValidator<Annotation,Collection<?>>public void setValidatorFactory(javax.validation.ValidatorFactory factory)
protected boolean isWrapperAnnotation(Class<? extends Annotation> annotationType)
value attribute
of the type that extends Annotation[].protected Annotation[] unwrapConstraints(Annotation wrapper)
protected javax.validation.metadata.ConstraintDescriptor createConstraintDescriptor(Annotation constraint)
protected <T extends javax.validation.ConstraintValidator<?,?>> Map<Class,Class<? extends T>> categorizeValidatorsByType(List<Class<? extends T>> validatorClasses)
protected Class<?> determineTargetType(Class<? extends javax.validation.ConstraintValidator<?,?>> validatorClass)
protected javax.validation.ConstraintValidator getValidatorInstance(Class<?> type)
type - Type of the object to be validated.protected javax.validation.ConstraintValidator getAnyValidatorInstance()
protected javax.validation.ConstraintValidator findAndInitializeValidator(Class<?> type)
protected String createInterpolatedMessage(javax.validation.metadata.ConstraintDescriptor descriptor, Object value)
descriptor - Descriptor of the constraint that the value violated.value - The validated value.protected <T extends Annotation> T createConstraintAndCopyAttributes(Class<T> constraintType, Annotation source)
If the source constraint's message is empty, then it will
not copy it (so the default message of the target
constraint will be preserved).
constraintType - Type of the constraint to create.source - Any annotation to copy attribute values from.Copyright © 2013–2015. All rights reserved.