[hibernate-issues] [Hibernate-JIRA] Commented: (HV-549) add method ValidatorImpl.validateElement(Annotation[], Class<?>, Type, Object value, Class<?>... groups)

Hardy Ferentschik (JIRA) noreply at atlassian.com
Mon Jan 30 12:07:12 EST 2012


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

Hardy Ferentschik commented on HV-549:
--------------------------------------

{quote}
Check that a String value is a valid @Email
{quote}
Instantiate a _EmailValidator_, initialize it with the annotation and then call _isValid_.

I just don't see how your proposal fits into the Validator interface. It would create a lot in inconsistencies with the metadata api and also constraint violations. To even consider it, I would like to see some complete examples and how it would fit into the current API.  

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