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
- you can use constraints like Hibernate Validator's @ScriptAssert that let's you
write a free Groovy, EL, etc expression and be validated.
On 6 juin 2013, at 19:19, Thang Le <thangmle(a)gmail.com> wrote:
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
Let me know your thoughts on this suggestion.
beanvalidation-dev mailing list