*/
private <T> void validateReturnedValueInContext(
GroupValidationContext<ConstraintValidationListener<T>> context,
MethodDescriptorImpl methodDescriptor) {
final Groups groups = context.getGroups();
for (ConstraintDescriptor consDesc : methodDescriptor.getConstraintDescriptors()) {
ConstraintValidation validation = (ConstraintValidation) consDesc;
// 1. process groups
for (Group current : groups.getGroups()) {
context.setCurrentGroup(current);
validation.validate(context);
}
// 2. process sequences
for (List<Group> eachSeq : groups.getSequences()) {
for (Group current : eachSeq) {
context.setCurrentGroup(current);
validation.validate(context);
/**
* if one of the group process in the sequence leads to one or more validation failure,
* the groups following in the sequence must not be processed
*/
if (!context.getListener().isEmpty()) break;
}
}
}
if (methodDescriptor.isCascaded() && context.getValidatedValue() != null) {
context.setMetaBean(factoryContext.getMetaBeanFinder().
findForClass(context.getValidatedValue().getClass()));
// 1. process groups
for (Group current : groups.getGroups()) {
context.setCurrentGroup(current);
validateContext(context);
}
// 2. process sequences
for (List<Group> eachSeq : groups.getSequences()) {
for (Group current : eachSeq) {
context.setCurrentGroup(current);
validateContext(context);
/**
* if one of the group process in the sequence leads to one or more validation failure,