[hibernate-issues] [Hibernate-JIRA] Commented: (HV-274) Write a programmatic mapping API for constraint declarations

Hardy Ferentschik (JIRA) noreply at atlassian.com
Wed May 12 01:34:24 EDT 2010


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

Hardy Ferentschik commented on HV-274:
--------------------------------------

{quote}
I like the builder pattern approach. Sticking to the original pattern description from Bloch all the mandatory attributes (e.g. type) should be parameters of the addConstraint() method, otherwise users might forget to call the according method.
{quote}
Adding all parameters to the {{addConstraint()}} method is hard, especially since we have multiple varargs as well. Also it would not be a fluent API. An alternative would be be to have {{addConstraint(MetaConstraint meta)}}. To build the {{MetaConstraint}} we would have a {{MetaConstraintBuilder}}. To start the "building" process we would have {{MetaConstraintBuilder.createConstraint( ShoppingCartConstraint.class) ... }. Since only on the last level of this fluid API a actual {{MetaConstraint}} would be created we would have maybe the best of both worlds (fluid API + Builder pattern)

Some other thoughts:
* Do we want to be able to programmatically add constraint definitions? I guess so.
* Should the programmatic API have some functionality to ignore annotations? What the approach in HSearch in this case?

> Write a programmatic mapping API for constraint declarations
> ------------------------------------------------------------
>
>                 Key: HV-274
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-274
>             Project: Hibernate Validator
>          Issue Type: New Feature
>          Components: engine
>    Affects Versions: 4.0.2.GA
>            Reporter: Emmanuel Bernard
>            Assignee: Hardy Ferentschik
>             Fix For: 4.1.0
>
>


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