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

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed May 12 08:32:24 EDT 2010


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

Emmanuel Bernard commented on HV-274:
-------------------------------------

{quote}
That's true, but personally I think it "reads more fluid"  the way I proposed in my first comment. I also don't like "endless chaining" and think it is ok to call addConstraint for each new constraint. It also avoids the additional .configure or .freeze()
{quote}

So 

{code}
config.addConstraint( Size.class ).onField("items").ofType(ShoppingCart.class);
config.addConstraint( NotNull.class ).onField("items").ofType(ShoppingCart.class);
config.addValid( Size.class ).onField("items").ofType(ShoppingCart.class);
{code}

is more fluid, more liking and more readable than

{code}
config
  .type( ShoppingCart.class );
    .onField("items")
      .addConstraint( Size.class )
      .addConstraint( NotNull.class )
      .addValid()
{code}

Be honest :)

> 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