|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.bval.jsr303.ClassValidator
org.apache.bval.jsr303.extensions.MethodValidatorImpl
class MethodValidatorImpl
Description: experimental implementation of method-level-validation
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.bval.jsr303.ClassValidator |
---|
ClassValidator.Jsr303ValidationCallback |
Field Summary |
---|
Fields inherited from class org.apache.bval.jsr303.ClassValidator |
---|
factoryContext, groupsComputer |
Constructor Summary | |
---|---|
MethodValidatorImpl(ApacheFactoryContext factoryContext)
Create a new MethodValidatorImpl instance. |
Method Summary | ||
---|---|---|
protected BeanDescriptorImpl |
createBeanDescriptor(MetaBean metaBean)
Create a BeanDescriptorImpl |
|
|
validateParameter(Class<T> clazz,
Constructor<T> constructor,
Object parameter,
int parameterIndex,
Class<?>... groupArray)
Validate the parameter value based on the constraints described on the parameterIndex-th parameter of constructor . |
|
|
validateParameter(Class<T> clazz,
Method method,
Object parameter,
int parameterIndex,
Class<?>... groupArray)
Validate the parameter value based on the constraints described on the parameterIndex-th parameter of method . |
|
|
validateParameters(Class<T> clazz,
Constructor<T> constructor,
Object[] parameters,
Class<?>... groupArray)
Validate each parameter value based on the constraints described on the parameters of constructor . |
|
|
validateParameters(Class<T> clazz,
Method method,
Object[] parameters,
Class<?>... groupArray)
Validate each parameter value based on the constraints described on the parameters of method . |
|
|
validateReturnedValue(Class<T> clazz,
Method method,
Object returnedValue,
Class<?>... groupArray)
Validate each parameter value based on the constraints described on method . |
Methods inherited from class org.apache.bval.jsr303.ClassValidator |
---|
createContext, createValidationContextTraversal, getConstraintsForClass, getMetaBeanFinder, isTreatMapsLikeBeans, setTreatMapsLikeBeans, unrecoverableValidationError, unwrap, validate, validateBeanNet, validateProperty, validateProperty, validateValue, validateValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.validation.Validator |
---|
getConstraintsForClass, unwrap, validate, validateProperty, validateValue |
Constructor Detail |
---|
public MethodValidatorImpl(ApacheFactoryContext factoryContext)
factoryContext
- Method Detail |
---|
protected BeanDescriptorImpl createBeanDescriptor(MetaBean metaBean)
BeanDescriptorImpl
createBeanDescriptor
in class ClassValidator
BeanDescriptorImpl
instancepublic <T> Set<ConstraintViolation<T>> validateParameters(Class<T> clazz, Method method, Object[] parameters, Class<?>... groupArray)
method
. enhancement: method-level-validation not yet completly
implemented
example:
public @NotNull String saveItem(@Valid @NotNull Item item, @Max(23) BigDecimal
spec: The constraints declarations evaluated are the constraints hosted
on the parameters of the method or constructor. If @Valid is placed on a
parameter, constraints declared on the object itself are considered.
validateParameters
in interface MethodValidator
clazz
- class hosting the methodmethod
- the method whose parameters are currectly validatedparameters
- the parameter values passed to the method for invocationgroupArray
- groups targeted for validation
IllegalArgumentException
- enhancement: if the method does not belong to T
or if the Object[] does not match the method signaturepublic <T> Set<ConstraintViolation<T>> validateParameter(Class<T> clazz, Method method, Object parameter, int parameterIndex, Class<?>... groupArray)
method
.
validateParameter
in interface MethodValidator
clazz
- class hosting the methodmethod
- the method whose parameters are currectly validatedparameter
- the parameter value passed to the parameterIndex-t parameter of methodparameterIndex
- parameter index of the parameter validated in methodgroupArray
- groups targeted for validation
public <T> Set<ConstraintViolation<T>> validateParameters(Class<T> clazz, Constructor<T> constructor, Object[] parameters, Class<?>... groupArray)
constructor
.
validateParameters
in interface MethodValidator
clazz
- class hosting the constructorconstructor
- the constructor whose parameters are correctly validatedparameters
- the parameter values passed to the constructor for invocationgroupArray
- groups targeted for validation
public <T> Set<ConstraintViolation<T>> validateParameter(Class<T> clazz, Constructor<T> constructor, Object parameter, int parameterIndex, Class<?>... groupArray)
constructor
.
validateParameter
in interface MethodValidator
clazz
- class hosting the constructorconstructor
- the method whose parameters are correctly validatedparameter
- the parameter value passed to the
parameterIndex-th parameter of constructorparameterIndex
- parameter index of the parameter validated in constructorgroupArray
- groups targeted for validation
public <T> Set<ConstraintViolation<T>> validateReturnedValue(Class<T> clazz, Method method, Object returnedValue, Class<?>... groupArray)
method
. If @Valid is placed on the method, the constraints declared
on the object itself are considered.
validateReturnedValue
in interface MethodValidator
clazz
- class hosting the methodmethod
- the method whose result is validatedreturnedValue
- the value returned by the method invocationgroupArray
- groups targeted for validation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |