You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Roman Stumm (JIRA)" <bv...@incubator.apache.org> on 2010/05/19 10:49:55 UTC

[jira] Commented: (BVAL-47) Correctly follow GroupSequence definitions when validating

    [ https://issues.apache.org/jira/browse/BVAL-47?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869060#action_12869060 ] 

Roman Stumm commented on BVAL-47:
---------------------------------

<<It could be an option to completely remove inheritance in the future to obtain a cleaner ClassValidator.>>
Yes, I already thought about this, because inheritance of BeanValidator/ClassValidator is a remainder of the early implementation phase, when I did not think about Groups or GroupSequences. It is now rather a bad example of how NOT to use inheritance, but I will need to have a closer look...

> Correctly follow GroupSequence definitions when validating
> ----------------------------------------------------------
>
>                 Key: BVAL-47
>                 URL: https://issues.apache.org/jira/browse/BVAL-47
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Roman Stumm
>         Attachments: bval-core-47.patch, bval-jsr303-47.patch
>
>
> I'm submitting this here for review as the solution involves many structural changes in ClassValidator. If you think the patch is fine, I can merge it once I get commit access.
> Basically, when validating the default group in a bean:
> - If a group sequence is defined in the bean class, iterate that sequence and stop if any violation is found.
> - If no group sequence is defined in the bean class, get the hierarchy of classes in the bean, and for each class, check the constraints defined in that class or interface according to the group sequence defined in that class.
> The same algorithm must be applied to related beans (@Valid), and validation starts again from the default group for them (groups defined in the group sequence of their parent bean must not be applied to their related beans).
> I added 2 additional tests, those and the TCK tests in GroupSequenceIsolationTest should help clarify the spec regarding this.
> Resulting ClassValidator is quite decoupled from BeanValidator (the class it inherits from, in bval-core). Some of the methods are similar in code, but the order in which they are called differs, so overriding wasn't an option. It could be an option to completely remove inheritance in the future to obtain a cleaner ClassValidator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.