[bv-dev] Value extraction open issue #2: per constraint ConstraintsApplyTo?
gunnar at hibernate.org
Fri Jan 13 09:22:18 EST 2017
As a variation of Matt's idea, an optional index() parameter could be added:
@ApplyConstraintTo(constraint=Size.class, index=1, target=WRAPPED_VALUE)
It could be omitted (via a default value of -1 or similar) if there is
only one constraint of the type in question:
Does the trick, though it's still a tad verbose.
2017-01-13 14:58 GMT+01:00 Emmanuel Bernard <emmanuel at hibernate.org>:
> On 13 Jan 2017, at 13:29, Guillaume Smet <guillaume.smet at gmail.com> wrote:
> On Fri, Jan 13, 2017 at 1:01 PM, Gunnar Morling <gunnar at hibernate.org>
>> Unfortunately, validationAppliesTo() is already taken:
>> It's used to distinguish between return value and cross-parameter
>> Any other name I can think of right now would make up for much
>> confusion with that option.
> Too good to be true :).
> That being said, I'm wondering if we could reuse it and just add 2 other
> values to ConstraintTarget. All in all, it's the same concept. The default
> being IMPLICIT is not too bad either.
> Right I think it’s worth exploring.
> I still like my group repurposing trick though even if it offenses the clean
> camp :)
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
More information about the beanvalidation-dev