[hibernate-dev] [Validator] method level validation

Hardy Ferentschik hibernate at ferentschik.de
Mon Oct 4 03:50:25 EDT 2010


Thanks Gunnar. I'll have a look at it and come back to you.


On Mon, 04 Oct 2010 00:32:27 +0200, Gunnar Morling  
<gunnar.morling at googlemail.com> wrote:

> Hi,
>
> I pushed a first rough draft for the method-level validation to GitHub at
> http://github.com/gunnarmorling/hibernate-validator/tree/method-level-preparations
>
> Currently only validateParameter() is implemented, but it shows, where  
> the
> journey could be going. The draft is implemented as outlined in my  
> previous
> mail:
>
> * MethodConstraintViolation extends ConstraintViolation with two  
> attributes
> "method" and "parameterIndex", which are always set
> * ConstraintViolation#rootBean and propertyPath are set relative to any
> parameter annotated with @Valid, otherwise they are null
>
> The test at
> http://github.com/gunnarmorling/hibernate-validator/blob/method-level-preparations/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/methodlevel/MethodLevelValidationTest.java
>
> should give you an impression. Validation is triggered by a dynamic
> proxy/invocation handler in the test.
>
> I think I'll have a look at the property path stuff next. I'm still not
> sure, whether the path API is the right thing to represent parameters.
>
> Using annotations for parameter names is a good idea, but as you said it
> should be optional. Method-level validation should not require name
> annotations.




More information about the hibernate-dev mailing list