[hibernate-issues] [Hibernate-JIRA] Commented: (HV-253) Fluent API to add path nodes is not flexible enough

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed Oct 14 11:00:42 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34190#action_34190 ] 

Emmanuel Bernard commented on HV-253:
-------------------------------------

Here is how you do it
			for (int index = 0; index < group.persons.size(); index++) {
				Person person = group.persons.get(index);
				if (!group.gender.equals(person.gender)) {
					constraintValidatorContext
							.buildConstraintViolationWithTemplate("constraints.CompatiblePersons.gender.message")
							.addNode("persons") // .inIterable() not available here!
							.addNode(null).inIterable().atIndex(index)
							.addConstraintViolation();
					return false;
				}
			}



> Fluent API to add path nodes is not flexible enough
> ---------------------------------------------------
>
>                 Key: HV-253
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-253
>             Project: Hibernate Validator
>          Issue Type: Improvement
>          Components: validators
>    Affects Versions: 4.0.0.GA
>         Environment: Win XP, Java 1.6
>            Reporter: Jaro Kuruc
>            Assignee: Hardy Ferentschik
>         Attachments: PropertyPathValidatorTests.java
>
>
> Hi, I am trying to implement custom validator in which I am using ConstraintValidatorContext to build my constraint violation and its property path.
> However, it looks to me that current API prevents from building certain property paths, specifically top level iterables. Have a look at the attached unit test.

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list