org.apache.bval.jsr303.extensions
Interface MethodValidator

All Superinterfaces:
Validator
All Known Implementing Classes:
MethodValidatorImpl

public interface MethodValidator
extends Validator

Description: Appendix C. Proposal for method-level validation. This interface contains the APIs added to javax.validation.Validator. It can be removed as soon as the Validator interface contains these methods. The extension is not a part of the JSR303 core specification yet, but could be in a future revision.
You can access the extension via the use of the Validator.unwrap() method.


Method Summary
<T> Set<ConstraintViolation<T>>
validateParameter(Class<T> clazz, Constructor<T> constructor, Object parameterValue, int parameterIndex, Class<?>... groups)
          Validate the parameter value based on the constraints described on the parameterIndex-th parameter of constructor.
<T> Set<ConstraintViolation<T>>
validateParameter(Class<T> clazz, Method method, Object parameterValue, int parameterIndex, Class<?>... groups)
          Validate the parameter value based on the constraints described on the parameterIndex-th parameter of method.
<T> Set<ConstraintViolation<T>>
validateParameters(Class<T> clazz, Constructor<T> constructor, Object[] parameterValues, Class<?>... groups)
          Validate each parameter value based on the constraints described on the parameters of constructor.
<T> Set<ConstraintViolation<T>>
validateParameters(Class<T> clazz, Method method, Object[] parameterValues, Class<?>... groups)
          Validate each parameter value based on the constraints described on the parameters of method.
<T> Set<ConstraintViolation<T>>
validateReturnedValue(Class<T> clazz, Method method, Object returnedValue, Class<?>... groups)
          Validate each parameter value based on the constraints described on method.
 
Methods inherited from interface javax.validation.Validator
getConstraintsForClass, unwrap, validate, validateProperty, validateValue
 

Method Detail

validateParameters

<T> Set<ConstraintViolation<T>> validateParameters(Class<T> clazz,
                                                   Method method,
                                                   Object[] parameterValues,
                                                   Class<?>... groups)
Validate each parameter value based on the constraints described on the parameters of method.

Parameters:
clazz - class hosting the method
method - the method whose parameters are currectly validated
parameterValues - the parameter values passed to the method for invocation
groups - groups targeted for validation
Returns:
set of constraint violations
Throws:
IllegalArgumentException - if the method does not belong to T or if the Object[] does not match the method signature

validateParameter

<T> Set<ConstraintViolation<T>> validateParameter(Class<T> clazz,
                                                  Method method,
                                                  Object parameterValue,
                                                  int parameterIndex,
                                                  Class<?>... groups)
Validate the parameter value based on the constraints described on the parameterIndex-th parameter of method.

Parameters:
clazz - class hosting the method
method - the method whose parameters are currectly validated
parameterValue - the parameter value passed to the parameterIndex-t parameter of method
parameterIndex - parameter index of the parameter validated in method
groups - groups targeted for validation
Returns:
set of constraint violations
Throws:
IllegalArgumentException - if the method does not belong to T or if parameterIndex is out of bound

validateReturnedValue

<T> Set<ConstraintViolation<T>> validateReturnedValue(Class<T> clazz,
                                                      Method method,
                                                      Object returnedValue,
                                                      Class<?>... groups)
Validate each parameter value based on the constraints described on method.

Parameters:
clazz - class hosting the method
method - the method whose result is validated
returnedValue - the value returned by the method invocation
groups - groups targeted for validation
Returns:
set of constraint violations
Throws:
IllegalArgumentException - if the method does not belong to T

validateParameters

<T> Set<ConstraintViolation<T>> validateParameters(Class<T> clazz,
                                                   Constructor<T> constructor,
                                                   Object[] parameterValues,
                                                   Class<?>... groups)
Validate each parameter value based on the constraints described on the parameters of constructor.

Parameters:
clazz - class hosting the constructor
constructor - the constructor whose parameters are correctly validated
parameterValues - the parameter values passed to the constructor for invocation
groups - groups targeted for validation
Returns:
set of constraint violations
Throws:
IllegalArgumentException - if the constructor does not belong to T or if the Object[] does not match the constructor signature

validateParameter

<T> Set<ConstraintViolation<T>> validateParameter(Class<T> clazz,
                                                  Constructor<T> constructor,
                                                  Object parameterValue,
                                                  int parameterIndex,
                                                  Class<?>... groups)
Validate the parameter value based on the constraints described on the parameterIndex-th parameter of constructor.

Parameters:
clazz - class hosting the constructor
constructor - the method whose parameters are correctly validated
parameterValue - the parameter value passed to the parameterIndex-th parameter of constructor
parameterIndex - parameter index of the parameter validated in constructor
groups - groups targeted for validation
Returns:
set of constraint violations
Throws:
IllegalArgumentException - if the constructor does not belong to T or if prameterIndex is out of bound


Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.