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

On 13 Jan 2017, at 18:54, Matt Benson <mbenson@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev