public class ValidatorImpl extends Object implements Validator, ExecutableValidator
| Constructor and Description |
|---|
ValidatorImpl(ConstraintValidatorFactory constraintValidatorFactory,
MessageInterpolator messageInterpolator,
TraversableResolver traversableResolver,
BeanMetaDataManager beanMetaDataManager,
ParameterNameProvider parameterNameProvider,
TimeProvider timeProvider,
TypeResolutionHelper typeResolutionHelper,
List<ValidatedValueUnwrapper<?>> validatedValueHandlers,
ConstraintValidatorManager constraintValidatorManager,
boolean failFast) |
| Modifier and Type | Method and Description |
|---|---|
ExecutableValidator |
forExecutables()
Returns the contract for validating parameters and return values of methods
and constructors.
|
BeanDescriptor |
getConstraintsForClass(Class<?> clazz)
Returns the descriptor object describing bean constraints.
|
<T> T |
unwrap(Class<T> type)
Returns 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<ConstraintViolation<T>> |
validateConstructorParameters(Constructor<? extends T> constructor,
Object[] parameterValues,
Class<?>... groups)
Validates all constraints placed on the parameters of the given constructor.
|
<T> Set<ConstraintViolation<T>> |
validateConstructorReturnValue(Constructor<? extends T> constructor,
T createdObject,
Class<?>... groups)
Validates all return value constraints of the given constructor.
|
<T> Set<ConstraintViolation<T>> |
validateParameters(T object,
Method method,
Object[] parameterValues,
Class<?>... groups)
Validates all constraints placed on the parameters of the 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<ConstraintViolation<T>> |
validateReturnValue(T object,
Method method,
Object returnValue,
Class<?>... groups)
Validates all return value constraints of the 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. |
public ValidatorImpl(ConstraintValidatorFactory constraintValidatorFactory, MessageInterpolator messageInterpolator, TraversableResolver traversableResolver, BeanMetaDataManager beanMetaDataManager, ParameterNameProvider parameterNameProvider, TimeProvider timeProvider, TypeResolutionHelper typeResolutionHelper, List<ValidatedValueUnwrapper<?>> validatedValueHandlers, ConstraintValidatorManager constraintValidatorManager, 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 ValidatorT - the type of the object to validateobject - object to validatepropertyName - property to validate (i.e. field and getter constraints)groups - the group or list of groups targeted for validation (defaults 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 ValidatorT - the type of the object to validatebeanType - the bean typepropertyName - property to validatevalue - property value to validategroups - the group or list of groups targeted for validation (defaults to
Default).public <T> Set<ConstraintViolation<T>> validateParameters(T object, Method method, Object[] parameterValues, Class<?>... groups)
ExecutableValidatorvalidateParameters in interface ExecutableValidatorT - the type hosting the method to validateobject - the object on which the method to validate is invokedmethod - the method for which the parameter constraints is validatedparameterValues - the values provided by the caller for the given method's
parametersgroups - the group or list of groups targeted for validation (defaults to
Default)nullpublic <T> Set<ConstraintViolation<T>> validateConstructorParameters(Constructor<? extends T> constructor, Object[] parameterValues, Class<?>... groups)
ExecutableValidatorvalidateConstructorParameters in interface ExecutableValidatorT - the type hosting the constructor to validateconstructor - the constructor for which the parameter constraints is validatedparameterValues - the values provided by the caller for the given constructor's
parametersgroups - the group or list of groups targeted for validation (defaults to
Default)nullpublic <T> Set<ConstraintViolation<T>> validateConstructorReturnValue(Constructor<? extends T> constructor, T createdObject, Class<?>... groups)
ExecutableValidatorvalidateConstructorReturnValue in interface ExecutableValidatorT - the type hosting the constructor to validateconstructor - the constructor for which the return value constraints is validatedcreatedObject - the object instantiated by the given methodgroups - the group or list of groups targeted for validation (defaults to
Default)nullpublic <T> Set<ConstraintViolation<T>> validateReturnValue(T object, Method method, Object returnValue, Class<?>... groups)
ExecutableValidatorvalidateReturnValue in interface ExecutableValidatorT - the type hosting the method to validateobject - the object on which the method to validate is invokedmethod - the method for which the return value constraints is validatedreturnValue - the value returned by the given methodgroups - the group or list of groups targeted for validation (defaults to
Default)nullpublic final BeanDescriptor getConstraintsForClass(Class<?> clazz)
Validator
The returned object (and associated objects including
ConstraintDescriptors) are immutable.
getConstraintsForClass in interface Validatorclazz - class or interface type evaluatedpublic final <T> T unwrap(Class<T> type)
Validator
If the Bean Validation provider implementation does not support
the specified class, ValidationException is thrown.
public ExecutableValidator forExecutables()
ValidatorforExecutables in interface ValidatorCopyright © 2018 JBoss by Red Hat. All rights reserved.