[bv-dev] Value extraction open issue #2: per constraint ConstraintsApplyTo?

Matt Benson mbenson at apache.org
Tue Jan 17 11:22:52 EST 2017


On Tue, Jan 17, 2017 at 6:56 AM, Emmanuel Bernard <emmanuel at hibernate.org>
wrote:

>
> On 13 Jan 2017, at 18:54, Matt Benson <mbenson at apache.org> wrote:
>
> As I warned, however, defining these might become tedious. It might be
> helpful to define a mechanism (like that supported by Spring) to map
> annotation elements:
>
> @Size
> @ConstraintsApplyTo(WRAPPED_VALUE)
> @Constraint
> public @interface WrappedSize {
>
>   @MapTo(type=Size.class, attribute="min")
>   int min() default 0;
>
>   @MapTo(type=Size.class, attribute="max")
>   int max() default Integer.MAX_VALUE;
>
>   String message() default "";
>   Class<?> groups() default {};
>   Class<? extends Payload>[] payload() default {};
> }
>
> @Size(1) @WrappedSize(min=3) StringList nicknames;
>
>
> If you mean something like @MapTo, the spec already has that via
> @OverridesAttribute
> AFAIK we invented it.
>
>
Sorry, it's been awhile since I've used BV in real life. But yes, that's
what I mean.

Matt

> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20170117/5d0f9add/attachment.html 


More information about the beanvalidation-dev mailing list