[
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-202?page=c...
]
Emmanuel Bernard commented on BVAL-202:
---------------------------------------
Adding Sebastian Thomschke's proposal
{code}
Hi,
I remember we had a discussion whether or not to allow the validation of a map's keys.
And at the time being the decision was made to not support this.
In OVal 1.40 I introduced a feature that gives users control on how a constraint should be
applied. For example when you have a not-null constraint for a map field your use cases
could be, the map's keys may not contain null, none of the map's value may null,
or the map itself may not be null. In OVal you can do this:
@NotNull
private Map myMap; // the map and the values may not be null
@NotNull(appliesTo = ConstraintTarget.CONTAINER)
private Map myMap; // the map itself may not be null
@NotNull(appliesTo = ConstraintTarget.VALUES)
private Map myMap; // the values may not be null
@NotNull(appliesTo = ConstraintTarget.KEYS)
private Map myMap; // the keys may not be null
@NotNull(appliesTo =
{ConstraintTarget.CONTAINER,ConstraintTarget.KEYS,ConstraintTarget.VALUES})
private Map myMap; // the map itslef, keys and values may not be null
This also works for Lists and Arrays...of course the option Container.KEYS is ignored
there.
Any thoughts?
Regards,
Seb
{code}
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