[
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-202?page=c...
]
Gunnar Morling commented on BVAL-202:
-------------------------------------
It would compile, if there was a dedicated @ValidateEach annotation for each constraint,
as with @List today:
{noformat}
public @interface Size {
String message() default "{javax.validation.constraints.Size.message}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
int min() default 0;
int max() default Integer.MAX_VALUE;
@interface List {
Size[] value();
}
@interface ValidateEach {
Size[] value();
}
}
{noformat}
This would read pretty good as long as only one @ValidateEach is imported. Also list
semantics are covered:
{noformat}
@NotNull
@Size(max=30)
@ValidateEach({@Size(max=30), @Size(max=40, groups=Admin.class) })
Collection<String> emails;
{noformat}
It reads slightly worse but still ok when multiple @ValidateEach are required:
{noformat}
@NotNull
@Size(max=30)
@Size.ValidateEach({@Size(max=30), @Size(max=40, groups=Admin.class) })
@Email.ValidateEach(@Email)
Collection<String> emails;
{noformat}
So basically this is similar to #4 without having all attributes from the original
constraint again in the sub-annotation.
Apply constraints on the elements of an iterator
------------------------------------------------
Key: BVAL-202
URL:
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-202
Project: Bean Validation
Issue Type: New Feature
Components: spec-general
Reporter: Emmanuel Bernard
Assignee: Hardy Ferentschik
The use case is the ability to ask a constraint to be applied, not on the annotated
element itself but on the elements contained by the annotated element (typically an
Iterator). Hardy and I have been discussing various options. I will list them in various
comments
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira