[bv-dev] Is it allowed to validate complete paths using Validator#validateProperty()

Gunnar Morling gunnar at hibernate.org
Mon Jun 4 14:53:08 EDT 2012


2012/6/4 Hardy Ferentschik <hardy at hibernate.org>:
>
> On Jun 4, 2012, at 1:46 PM, Emmanuel Bernard wrote:
>
>> Hi,
>>
>> It was meant to be supported in a future version and to let implementors experiment with such a support first.
>> If we officially support it we need to:
>>
>> - standardize the String representation of a Path, which is something we shied away from in 1.0
>
> In this context we also need to think about how to represent method level validation paths.
> Property paths are relative straight forward (based on users experience with EL) and I have not come across
>  a case where someone had problems with the approach taken for example in Hibernate Validator.
>
> Finding a good path representation for method level validation is harder though.

Yepp, that's tricky indeed, in particular for return value constraints.

>
>> - offer an alternative methods accepting Path ; we would also need to offer a PathBuilder of sort
>
> The more I think about it the more I like the idea of having a #validateProperty and #validateValue
> which take a Path instance as parameter.

+1. Maybe this would even avoid the need for specifying path String
representations. validateValue(String propertyName) would support
single properties as before, while complete paths could be validated
using the new methods.

I'm also starting to see Emmanuel's point about pushing the method
validation methods to another interface to avoid too many methods on
j.v.Validator :)

I've created https://hibernate.onjira.com/browse/BVAL-294, just in
case someone feels like giving this some more thoughts.

--Gunnar


>
> --Hardy
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev



More information about the beanvalidation-dev mailing list