[bv-dev] Data-driven execution for validation constraints

Emmanuel Bernard emmanuel at hibernate.org
Thu Jun 6 13:55:18 EDT 2013


Hello,

You will have to dive into more concrete use cases. We did not add such a feature so far for a few reasons:

- groups are offering a way to validate specific subset of constraints and solve a good chunk of non static use cases as you put it. 
- you can write a custom constraint (property or class level) to achieve this. That's a bit less reusable but is more readable and could be done in a more type safe way (than an EL)
- you can use constraints like Hibernate Validator's @ScriptAssert that let's you write a free Groovy, EL, etc expression and be validated. 

Emmanuel

On 6 juin 2013, at 19:19, Thang Le <thangmle at gmail.com> wrote:

> Hi all,
> 
> Validation constraints defined in Bean Validation 1.1 are mostly written and assigned in static manner. This limits us to reuse the existing constraints in value-driven manner. Could we add a new attribute 'executeCondition' to the constrain definition? 'executeCondition' would take an EL expression. A bean validation framework would need to evaluate the expression set in this attribute. The corresponding constraint logic only gets executed when the expression set for 'executeCondition' is satisfied at runtime.
> 
> Let me know your thoughts on this suggestion.
> 
> Thanks,
> Thang
> _______________________________________________
> 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