]
Gunnar Morling commented on BVAL-245:
-------------------------------------
{quote}
Constraints on parameters whose type is a subtype of the accepted types by the constraint
are declared directly on the parameter
{quote}
I'm wondering how class-level constraints fit into this. Given
{code}
@ValidKitten
public class Kitten { ... }
{code}
I would personally prefer something like
{code}
void doHarm(@ValidParameter Kitten kitten);
{code}
over
{code}
void doHarm(@ValidKitten Kitten kitten);
{code}
This would be similar to using {{@Valid}} for cascaded validation.
Btw. I'd like to distance myself from the perfidious example chosen by the OP ;-)
Define how method constraints are declared at parameters and return
values
--------------------------------------------------------------------------
Key: BVAL-245
URL:
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-245
Project: Bean Validation
Issue Type: Sub-task
Components: spec-general
Reporter: Gunnar Morling
Fix For: 1.1
Emmanuel:
{quote}
Constraints on parameters whose type is a subtype of the accepted types by the constraint
are declared directly on the parameter
void doHarm(@NotEmpty String kittenName);
Constrains on parameters whose type is a constrained bean needs an annotation accepting
the targeted groups. It was proposed to use @Valid for such case but [recent
discussions|https://hibernate.onjira.com/browse/BVAL-208?focusedCommentId...]
brought that back on the drawing board.
There are a few notions floating around @Valid
1. cascade validation to nested beans
2. translate the validation of group A from the owning bean to validation of the group B
on the nested bean (see BVAL-208)
3. define the group to validate in a method level validation
About 3., I wonder if this should be part of Bean Validation or be part of the
interception framework. In other words:
* should it be an annotation provided / proposed by Bean Validation and recognized by
interception techs like CDI, @Inject, Spring, AspectJ etc
* should each interception tech provide its own annotation to specify the targeted
group(s)
{quote}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: