You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by Matt Benson <gu...@gmail.com> on 2010/07/12 18:33:53 UTC

Dynamic constraints

A colleague just sent over a link to a blog about the Hibernate Validator 4.1.0 release:

http://musingsofaprogrammingaddict.blogspot.com/2010/06/whats-new-in-hibernate-validator-41.html

In particular, they now offer a dynamic API.  Does anyone have any thoughts on the API they've created?  IMO if they have dynamic constraints, and bval has dynamic constraints, eventually the spec will have dynamic constraints.  I personally don't think that dynamic constraints are that powerful unless you have ways of "branching" constraint mappings from globally-applicable down to instance-level (and possibly steps in between).  I'm also not thrilled with their fluent builders:  they seem nice to use at compile-time, but the fact that they would require a different builder per constraint type to be written or generated seems less than optimal.  I am wondering if we could borrow some ideas from e.g. Mockito to stay typesafe and compiler-checked yet avoid the need to write a builder per constraint.

Thoughts?

-Matt

Re: Dynamic constraints

Posted by Gerhard Petracek <ge...@gmail.com>.
hi matt,

if you have some interesting ideas we can prototype them. as soon as we have
a nice solution, i'll discuss it in the eg.

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2010/7/12 Matt Benson <gu...@gmail.com>

> A colleague just sent over a link to a blog about the Hibernate Validator
> 4.1.0 release:
>
>
> http://musingsofaprogrammingaddict.blogspot.com/2010/06/whats-new-in-hibernate-validator-41.html
>
> In particular, they now offer a dynamic API.  Does anyone have any thoughts
> on the API they've created?  IMO if they have dynamic constraints, and bval
> has dynamic constraints, eventually the spec will have dynamic constraints.
>  I personally don't think that dynamic constraints are that powerful unless
> you have ways of "branching" constraint mappings from globally-applicable
> down to instance-level (and possibly steps in between).  I'm also not
> thrilled with their fluent builders:  they seem nice to use at compile-time,
> but the fact that they would require a different builder per constraint type
> to be written or generated seems less than optimal.  I am wondering if we
> could borrow some ideas from e.g. Mockito to stay typesafe and
> compiler-checked yet avoid the need to write a builder per constraint.
>
> Thoughts?
>
> -Matt