[hibernate-issues] [Hibernate-JIRA] Commented: (BVAL-12) <T> in ValidatorContext<T> Validator<T> and InvalidConstraint<T> are inadequately considered unique
Hardy Ferentschik (JIRA)
noreply at atlassian.com
Mon Oct 20 11:09:04 EDT 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/BVAL-12?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31470#action_31470 ]
Hardy Ferentschik commented on BVAL-12:
---------------------------------------
> A context can be created in a validator (T are equal). but the same context (a clone really) can be passed to a sub validator. Ts are then different. I believe it's the same for InvalidConstraints. An IC created by a
> subvalidator<U> will craete IC<U>, you will need to convert them in IC<T> when coming to the root validator<T>.
First I thought you were right, but I am not so sure anymore. The type variable T in ValidationContext and InvalidConstraint refer to the rootBean, meaning that original instance object and type passed to validate. This rootBean stays the same even if I pass the context to a subvalidator. At least if I remember right. On the other hand some parts of the API have changed. For example, I am not sure anymore which Class getBeanClass() should return? The root bean class or the class of the currently validated object.
> <T> in ValidatorContext<T> Validator<T> and InvalidConstraint<T> are inadequately considered unique
> ---------------------------------------------------------------------------------------------------
>
> Key: BVAL-12
> URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-12
> Project: Bean Validation
> Issue Type: Sub-task
> Components: ri-general
> Reporter: Emmanuel Bernard
> Assignee: Hardy Ferentschik
>
> In ValidatorImpl.validate()
> T Generic of ValidatorContext<T> and InvalidConstraint<T> are likely to be different than the Validator<T>
> A context can be created in a validator (T are equal). but the same context (a clone really) can be passed to a sub validator. Ts are then different. I believe it's the same for InvalidConstraints. An IC created by a subvalidator<U> will craete IC<U>, you will need to convert them in IC<T> when coming to the root validator<T>.
> So we need something like
> private <U> List<InvalidConstraintImpl<T>> validate(ValidationContext<U> context, List<String> groups) { }
> same for similar methods.
--
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