bval-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rudy De Busscher <rdebussc...@gmail.com>
Subject Question on non default groups value
Date Mon, 18 Jul 2011 19:17:02 GMT
hi  All,

The situation is a bit difficult to describe both I have a use case where I
would like to create a custom validation annotation where I need to define a
non empty groups attribute

something like this
*@Target(value = { ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
@Constraint(validatedBy = { EqualsValidator.class })
public @interface Equals
{
    String message() default "{duplicated_content_required}";

    Class<?>[] groups() default {CrossValidationGroup.class};

    Class<? extends Payload>[] payload() default {};

    String[] value();
}
*

But as expected, I get a error when I try to use the annotation:
Default value for groups() must be an empty array

But I want to avoid that the user needs to define it always when he uses the
annotation.
  *  @Equals(value = "caseSensitiveTarget", groups =
CrossValidationGroup.class)
    private String caseSensitiveSource;*


Any idea or direction I need to look into are apreciated.

Regards

-- 
Rudy De Busscher
http://www.c4j.be

Mime
View raw message