Determine whether a property is indexed based on the runtime not static type
----------------------------------------------------------------------------
Key: HV-468
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-468
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.2.0.Beta2
Reporter: Hardy Ferentschik
Fix For: 4.2.0.Final
from the mailing list:
{quote}
there was an interesting question on the Validator forum
(
https://forum.hibernate.org/viewtopic.php?f=9&t=1010626&start=0)
which IMO boils down to the question whether the static or the runtime
type of an association should be considered when creating property
paths in case of cascading validations.
An example:
{code}
class Foo {
private Collection<Bar> bar1 = new ArrayList<Bar>();
private List<Bar> bar2 = new ArrayList<Bar>();
}
{code}
When validating an instance of Foo (which has invalid elements in
bar1/bar2) with HV, the resulting property path node for bar1 would be
iterable but not indexable ("bar1[]"), while the property path node
for bar2 would be iterable and indexable ("bar2[123]"). This is that
way because the static type of bar1/bar2 (Collection vs. List) is
considered when building the nodes, and not the runtime type
(ArrayList in both cases).
That said, basing the path on the runtime type instead would seem
reasonable to me, too (as for instance the constraints to validate are
also determined based on the runtime type of references). I scanned
through the BV spec. (section 4.5) but didn't find a clear answer
which approach should be followed. Are there any opinions on that?
{quote}
--
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