[hibernate-issues] [Hibernate-JIRA] Commented: (BVAL-237) Expose validated bean via ConstraintValidatorContext

Emmanuel Bernard (JIRA) noreply at atlassian.com
Tue Sep 27 11:35:35 EDT 2011


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

Emmanuel Bernard commented on BVAL-237:
---------------------------------------

My main problem with that is leakage. Forget validateValue, forget reliable validate based on changesets.

> Expose validated bean via ConstraintValidatorContext
> ----------------------------------------------------
>
>                 Key: BVAL-237
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-237
>             Project: Bean Validation
>          Issue Type: New Feature
>          Components: spec-general
>    Affects Versions: 1.0 final
>            Reporter: Gunnar Morling
>             Fix For: 1.1
>
>
> In the feedback forum a user [suggested|https://forum.hibernate.org/viewtopic.php?f=26&t=1012111] to expose the currently validated bean via {{javax.validation.ConstraintValidatorContext}}. 
> IMO that's a good addition as it would people allow to create custom cross-field constraints more easily. I'm not sure whether access should be restricted to the current leaf bean or whether also the root bean should be accessible. In the latter case some methods from {{ConstraintViolation}} might just be offered on {{ConstraintValidatorContext}} as well:
> {code:java}
> getConstraintDescriptor()
> getLeafBean()
> getPropertyPath()
> getRootBean()
> getRootBeanClass() 
> {code}
> Another idea would be to have an {{unwrap()}} method on {{ConstraintValidatorContext}} which would allow for BV providers to expose additional functionality. WDYT?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list