[hibernate-issues] [Hibernate-JIRA] Commented: (HV-549) add method ValidatorImpl.validateElement(Annotation[], Class<?>, Type, Object value, Class<?>... groups)
George Sapountzis (JIRA)
noreply at atlassian.com
Mon Jan 30 12:18:14 EST 2012
[ http://opensource.atlassian.com/projects/hibernate/browse/HV-549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45303#comment-45303 ]
George Sapountzis commented on HV-549:
--------------------------------------
I know there are workarounds but they have problems. IIRC "Instantiate a EmailValidator, initialize it with the annotation and then call isValid" requires that the isValid method does not use the validation context or checks for a null context or the caller builds a mock validation context.
Alternatively, bean validation could provide more generic extension points in the same fashion that data binders do.
I agree though that the proposal is rough and vague. Feel free to close it as invalid.
> add method ValidatorImpl.validateElement(Annotation[], Class<?>, Type, Object value, Class<?>... groups)
> --------------------------------------------------------------------------------------------------------
>
> Key: HV-549
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-549
> Project: Hibernate Validator
> Issue Type: New Feature
> Components: engine
> Reporter: George Sapountzis
>
> ValidatorImpl currently supports methods for validating bean properties / method parameters. Looking from the outside, I don't see a strong reason for using bean properties / method parameters other than that these elements are annotation placeholders.
> Using TypeLiteral/AnnotationLiteral helper classes it seems possible to construct all the necessary metadata for a validation point programmatically. So, I propose to add a generic method where the annotations/type are passed by the user. The passed value need not be a bean, it could be a *primitive* value. The resulting set of constraint violations will just have a null root bean / method.
> Hope you consider this a valid case and add such a method, or advise on an alternative way to achieve the same functionality. I'd like to do this without writing straw beans/methods and introspecting them just for the sake of adapting to the API. I am not able to find my way around to achieving this currently.
--
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