This was requested by different users 2 times in a row so it's definitely something that could be useful. Currently, we have a workaround by using a DefaultGroupSequenceProvider but a more natural way to do it would be welcome.
We should be able to:
decide if we trigger the validation for the/one of the cascaded object(s) depending on the cascaded object itself: not sure this would be easy as you could have a container, in which case you should consider each element of the container (we would probably need to add the annotation at the container level).
decide if we trigger the cascading entirely depending on the cascading object.
Something like:
class CascadingObject {
@Valid
@CascadingObjectCondition(MyPredicateOnCascadingObject.class)
private CascadedObject cascadedObject;
class CascadingObject {
@Valid
@CascadedObjectCondition(MyPredicateOnCascadedObject.class)
private CascadedObject cascadedObject;
class CascadingObject {
@Valid
private List<@CascadedObjectCondition(MyPredicateOnCascadedObject.class) CascadedObject> cascadedObject;
The names are terrible so part of the challenge is to find good names for this feature .