[hibernate-issues] [Hibernate-JIRA] Commented: (BVAL-221) The constraint violation builder cannot put constraint on a top level map key

Emmanuel Bernard (JIRA) noreply at atlassian.com
Thu Mar 10 08:38:08 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/BVAL-221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=40170#action_40170 ] 

Emmanuel Bernard commented on BVAL-221:
---------------------------------------

While this API call is not correct, something like that should be possible

{code}
  public boolean isValid(Map<String, String> target, ConstraintValidatorContext context) {
    context.buildConstraintViolationWithTemplate("oh noes")
                        .addNode(null) //ie the contained element
                            inIterable().atKey(someKey)
                        .addConstraintViolation();
    return false;
  }
{code}

> The constraint violation builder cannot put constraint on a top level map key
> -----------------------------------------------------------------------------
>
>                 Key: BVAL-221
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-221
>             Project: Bean Validation
>          Issue Type: Bug
>          Components: spec-general
>            Reporter: Emmanuel Bernard
>             Fix For: 1.1
>
>
> From Logan
> This is a minor thing and maybe tunnel-visioned (I don't know much about the other beans-related specs), but if I do something like this in a ConstraintValidator:
> {code}
>   public boolean isValid(Map<String, String> target, ConstraintValidatorContext context) {
>     context.buildConstraintViolationWithTemplate("oh noes")
>                         .addNode(somekey)
>                         .addConstraintViolation();
>     return false;
>   }
> {code}
> It would be nice if that resulted in a violation at path someobject.mapproperty[somekey] rather than someobject.mapproperty.somekey.

-- 
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