[bv-dev] Creating custom nodes in cross-parameter constraint validators

Gunnar Morling gunnar at hibernate.org
Tue Feb 19 07:00:46 EST 2013


Hi,

We added the method addParameterNode() to the node builder API, allowing
for the creation of custom subpaths in cross-parameter constraint
validators.

Currently such a path will look like this (the first two nodes are the
default ones, the remain ones are custom created nodes):

METHOD -> CROSS_PARAMETER -> PARAMETER -> ...

I'm wondering whether it wouldn't be better to get rid of the
cross-parameter node in this case:

METHOD -> PARAMETER -> ...

E.g. when looking at the following example:

    @OldAndNewPasswordDifferent
    public void resetPassword(String new, String old) { ... }

Then I think the following path might be what constraint authors want:

MethodNode("resetPassword") -> ParameterNode("old", arg1)

As it seems, the RI does the same when custom nodes are added in
class-level constraint validators (i.e. no node for the class-level
constraint will be part of the path). Shortly looking in the spec, I
couldn't find an example mandating this behavior, though.

Any thoughts?

--Gunnar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20130219/8313deb9/attachment.html 


More information about the beanvalidation-dev mailing list