public class ValidatorImpl extends Object implements Validator, MethodValidator
| Constructor and Description |
|---|
ValidatorImpl(ConstraintValidatorFactory constraintValidatorFactory,
MessageInterpolator messageInterpolator,
TraversableResolver traversableResolver,
ConstraintHelper constraintHelper,
BeanMetaDataCache beanMetaDataCache,
boolean failFast) |
| Modifier and Type | Method and Description |
|---|---|
BeanDescriptor |
getConstraintsForClass(Class<?> clazz)
Return the descriptor object describing bean constraints.
|
TypeDescriptor |
getConstraintsForType(Class<?> clazz)
Returns a descriptor providing access to constraint-related meta data for
the given type.
|
<T> T |
unwrap(Class<T> type)
Return an instance of the specified type allowing access to
provider-specific APIs.
|
<T> Set<ConstraintViolation<T>> |
validate(T object,
Class<?>... groups)
Validates all constraints on
object. |
<T> Set<MethodConstraintViolation<T>> |
validateAllParameters(T object,
Method method,
Object[] parameterValues,
Class<?>... groups)
Validates all parameters of a given method.
|
<T> Set<MethodConstraintViolation<T>> |
validateParameter(T object,
Method method,
Object parameterValue,
int parameterIndex,
Class<?>... groups)
Validates a given parameter of a given method.
|
<T> Set<ConstraintViolation<T>> |
validateProperty(T object,
String propertyName,
Class<?>... groups)
Validates all constraints placed on the property of
object
named propertyName. |
<T> Set<MethodConstraintViolation<T>> |
validateReturnValue(T object,
Method method,
Object returnValue,
Class<?>... groups)
Validates the return value of a given method.
|
<T> Set<ConstraintViolation<T>> |
validateValue(Class<T> beanType,
String propertyName,
Object value,
Class<?>... groups)
Validates all constraints placed on the property named
propertyName
of the class beanType would the property value be value
ConstraintViolation objects return null for
ConstraintViolation.getRootBean() and ConstraintViolation.getLeafBean() |
public ValidatorImpl(ConstraintValidatorFactory constraintValidatorFactory, MessageInterpolator messageInterpolator, TraversableResolver traversableResolver, ConstraintHelper constraintHelper, BeanMetaDataCache beanMetaDataCache, boolean failFast)
public final <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups)
Validatorobject.public final <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups)
Validatorobject
named propertyName.validateProperty in interface Validatorobject - object to validatepropertyName - property to validate (ie field and getter constraints)groups - group or list of groups targeted for validation
(default to Default)public final <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups)
ValidatorpropertyName
of the class beanType would the property value be value
ConstraintViolation objects return null for
ConstraintViolation.getRootBean() and ConstraintViolation.getLeafBean()validateValue in interface ValidatorbeanType - the bean typepropertyName - property to validatevalue - property value to validategroups - group or list of groups targeted for validation
(default to Default)public final <T> Set<MethodConstraintViolation<T>> validateParameter(T object, Method method, Object parameterValue, int parameterIndex, Class<?>... groups)
MethodValidatorvalidateParameter in interface MethodValidatorT - The type hosting the invoked method.object - The object on which the given method was invoked.method - The invoked method for which the given parameter shall be
validated.parameterValue - The value provided by the caller for the given method.parameterIndex - The index of the parameter to be validated within the given
method's parameter array.groups - A - potentially empty - number of validation groups for which
the validation shall be performed. The @link Default
group will be validated if no group is given.public final <T> Set<MethodConstraintViolation<T>> validateAllParameters(T object, Method method, Object[] parameterValues, Class<?>... groups)
MethodValidatorvalidateAllParameters in interface MethodValidatorT - The type hosting the invoked method.object - The object on which the given method was invoked.method - The invoked method for which the given parameter shall be
validated.parameterValues - The values provided by the caller for the given method's
parameters.groups - A - potentially empty - number of validation groups for which
the validation shall be performed. The @link Default
group will be validated if no group is given.public <T> Set<MethodConstraintViolation<T>> validateReturnValue(T object, Method method, Object returnValue, Class<?>... groups)
MethodValidatorvalidateReturnValue in interface MethodValidatorT - The type hosting the invoked method.object - The object on which the given method was invoked.method - The invoked method for which the given return value shall be
validated.returnValue - The value returned by the invoked method.groups - A - potentially empty - number of validation groups for which
the validation shall be performed. The @link Default
group will be validated if no group is given.public final BeanDescriptor getConstraintsForClass(Class<?> clazz)
ValidatorConstraintDescriptors) are immutable.getConstraintsForClass in interface Validatorclazz - class or interface type evaluatedpublic final TypeDescriptor getConstraintsForType(Class<?> clazz)
MethodValidatorgetConstraintsForType in interface MethodValidatorclazz - The type of interest.Copyright © 2012 JBoss by Red Hat. All Rights Reserved.