public class CommonEachValidator extends Object implements javax.validation.ConstraintValidator<Annotation,Collection<?>>
| Constructor and Description |
|---|
CommonEachValidator() |
| Modifier and Type | Method and Description |
|---|---|
protected Map<Class,javax.validation.ConstraintValidator> |
cache() |
protected <T extends javax.validation.ConstraintValidator<?,?>> |
categorizeValidatorsByType(List<Class<? extends T>> validatorClasses) |
protected javax.validation.metadata.ConstraintDescriptor |
createConstraintDescriptor(Annotation constraint)
Note: The member argument of the
ConstraintDescriptorImpl constructor is
set to null, which may cause problems in some specific situations. |
protected String |
createMessage(javax.validation.metadata.ConstraintDescriptor descriptor,
Object value) |
protected Class<?> |
determineTargetType(Class<? extends javax.validation.ConstraintValidator<?,?>> validatorClass) |
protected javax.validation.ConstraintValidator |
findAndInitializeValidator(Class<?> type) |
protected javax.validation.ConstraintValidator |
getCachedValidator(Class<?> type) |
void |
initialize(Annotation wrapper) |
boolean |
isValid(Collection<?> collection,
javax.validation.ConstraintValidatorContext context) |
protected String |
readMessageTemplate(Annotation constraint) |
void |
setValidatorFactory(javax.validation.ValidatorFactory factory) |
protected Annotation[] |
unwrapConstraints(Annotation wrapper) |
public void initialize(Annotation wrapper)
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 Annotation[] unwrapConstraints(Annotation wrapper)
protected javax.validation.metadata.ConstraintDescriptor createConstraintDescriptor(Annotation constraint)
ConstraintDescriptorImpl constructor is
set to null, which may cause problems in some specific situations.
The problem is that it's not possible to access the validated "member" (field, method,
constructor) from the validator context (or just don't know how). However, this "member"
argument is currently (HV v5.0.1) used only to determine type of the constraint in some
ambiguous situations (see ConstraintDescriptorImpl.determineConstraintType(java.lang.reflect.Member, java.lang.annotation.ElementType, boolean, boolean)).
It seems that it's not necessary for "normal" validators and everything works fine. But to
be honest, I'm not sure which specific types of validators will fail with this.
constraint - The constraint annotation to create descriptor for.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 getCachedValidator(Class<?> type)
protected javax.validation.ConstraintValidator findAndInitializeValidator(Class<?> type)
protected String readMessageTemplate(Annotation constraint)
Copyright © 2013–2014. All rights reserved.