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 Fri, 22 Jul 2011 08:51:51 GMT
hi rudy,

maybe we should think about both. providing a (different) default group for
a constraint sounds useful (maybe even for bv 1.1) if you have a constraint
which is (by definition) only useful for a specific group (in most or all
cases).

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/22 Rudy De Busscher <rdebusscher@gmail.com>

> Hi Gerhard,
>
> Disabling the standard requirements for just an add on of ExtVal seems a
> bit too drastic, but a transformer seems a good idea.  I'll try to make
> something and post it.
>
> Regards
> Rudy.
>
>
> On 18 July 2011 21:58, Gerhard Petracek <gerhard.petracek@gmail.com>wrote:
>
>> 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
>>>
>>>
>>
>
>
> --
> Rudy De Busscher
> http://www.c4j.be
>
>

Mime
View raw message