On 14 mai 2012, at 14:53, Hardy Ferentschik wrote:
>
> * Should method validation methods be defined on j.v.Validator or a
> dedicated new interface?
Should be on javax.validation.Validator
I still think my proposal is quite elegant and limit duplication
public interface Validator {
MethodValidator<T> forMethod(Method method, T object);
MethodValidator<T> forConstructor(Constructor<T> constructor);
}
public interface MethodValidator<T> {
<T> Set<MethodConstraintViolation<T>> validateParameter(
Object parameterValue, int parameterIndex, Class<?>... groups);
<T> Set<MethodConstraintViolation<T>> validateAllParameters(
Object[] parameterValues, Class<?>... groups);
<T> Set<MethodConstraintViolation<T>> validateReturnValue(
Object returnValue, Class<?>... groups);
}
http://beanvalidation.org/proposals/BVAL-241/#validating