public class ConstraintValidation<T extends Annotation> extends Object implements Validation, javax.validation.metadata.ConstraintDescriptor<T>
Constructor and Description |
---|
ConstraintValidation(Class<? extends javax.validation.ConstraintValidator<T,?>>[] validatorClasses,
javax.validation.ConstraintValidator<T,?> validator,
T annotation,
Class<?> owner,
AccessStrategy access,
boolean reportFromComposite)
Create a new ConstraintValidation instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addComposed(ConstraintValidation<?> aConstraintValidation)
Add a composing constraint.
|
javax.validation.metadata.ConstraintDescriptor<T> |
asSerializableDescriptor()
Return a
Serializable ConstraintDescriptor capturing a
snapshot of current state. |
AccessStrategy |
getAccess()
Get the
AccessStrategy used by this ConstraintValidation . |
T |
getAnnotation() |
Map<String,Object> |
getAttributes() |
Set<javax.validation.metadata.ConstraintDescriptor<?>> |
getComposingConstraints() |
List<Class<? extends javax.validation.ConstraintValidator<T,?>>> |
getConstraintValidatorClasses() |
Set<Class<?>> |
getGroups() |
String |
getMessageTemplate()
Get the message template used by this constraint.
|
Class<?> |
getOwner()
Get the owning class of this
ConstraintValidation . |
Set<Class<? extends javax.validation.Payload>> |
getPayload() |
javax.validation.ConstraintValidator<T,?> |
getValidator()
Get the
ConstraintValidator invoked by this
ConstraintValidation . |
void |
initialize()
Initialize the validator (if not
null ) with the stored
annotation. |
protected boolean |
isMemberOf(Class<?> reqGroup)
Learn whether this
ConstraintValidation belongs to the specified
group. |
boolean |
isReportAsSingleViolation() |
void |
setAnnotation(T annotation)
Override the Annotation set at construction.
|
String |
toString() |
<L extends ValidationListener> |
validate(ValidationContext<L> context)
Perform a single validation routine.
|
void |
validateGroupContext(GroupValidationContext<?> context)
Validate a
GroupValidationContext . |
public ConstraintValidation(Class<? extends javax.validation.ConstraintValidator<T,?>>[] validatorClasses, javax.validation.ConstraintValidator<T,?> validator, T annotation, Class<?> owner, AccessStrategy access, boolean reportFromComposite)
validatorClasses
- validator
- - the constraint validatorannotation
- - the annotation of the constraintowner
- - the type where the annotated element is placed (class,
interface, annotation type)access
- - how to access the valuereportFromComposite
- public javax.validation.metadata.ConstraintDescriptor<T> asSerializableDescriptor()
Serializable
ConstraintDescriptor
capturing a
snapshot of current state.ConstraintDescriptor
public boolean isReportAsSingleViolation()
isReportAsSingleViolation
in interface javax.validation.metadata.ConstraintDescriptor<T extends Annotation>
public void addComposed(ConstraintValidation<?> aConstraintValidation)
aConstraintValidation
- to addpublic <L extends ValidationListener> void validate(ValidationContext<L> context)
validate
in interface Validation
context
- - to access the property, value, constraintspublic void validateGroupContext(GroupValidationContext<?> context)
GroupValidationContext
.context
- rootpublic void initialize()
null
) with the stored
annotation.public String getMessageTemplate()
public javax.validation.ConstraintValidator<T,?> getValidator()
ConstraintValidator
invoked by this
ConstraintValidation
.protected boolean isMemberOf(Class<?> reqGroup)
ConstraintValidation
belongs to the specified
group.reqGroup
- public Class<?> getOwner()
ConstraintValidation
.public T getAnnotation()
getAnnotation
in interface javax.validation.metadata.ConstraintDescriptor<T extends Annotation>
public AccessStrategy getAccess()
AccessStrategy
used by this ConstraintValidation
.AccessStrategy
public void setAnnotation(T annotation)
annotation
- public Map<String,Object> getAttributes()
getAttributes
in interface javax.validation.metadata.ConstraintDescriptor<T extends Annotation>
public Set<javax.validation.metadata.ConstraintDescriptor<?>> getComposingConstraints()
getComposingConstraints
in interface javax.validation.metadata.ConstraintDescriptor<T extends Annotation>
public Set<Class<?>> getGroups()
getGroups
in interface javax.validation.metadata.ConstraintDescriptor<T extends Annotation>
public Set<Class<? extends javax.validation.Payload>> getPayload()
getPayload
in interface javax.validation.metadata.ConstraintDescriptor<T extends Annotation>
public List<Class<? extends javax.validation.ConstraintValidator<T,?>>> getConstraintValidatorClasses()
getConstraintValidatorClasses
in interface javax.validation.metadata.ConstraintDescriptor<T extends Annotation>
Copyright © 2010–2016 The Apache Software Foundation. All rights reserved.