[bv-dev] Value extraction open issue #2: per constraint ConstraintsApplyTo?
Emmanuel Bernard
emmanuel at hibernate.org
Tue Jan 17 07:56:55 EST 2017
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20170117/f97ad144/attachment-0001.html
More information about the beanvalidation-dev
mailing list