incubator-bval-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <gerhard.petra...@gmail.com>
Subject Re: Question on non default groups value
Date Mon, 18 Jul 2011 19:58:55 GMT
hi rudy,

we could discuss a bval feature which relaxes such rules (it would be
deactivated by default).
or something like transformer for constraints.

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2011/7/18 Rudy De Busscher <rdebusscher@gmail.com>

> 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