* validate constraints hosted on parameters of a method
*/
private <T> void validateReturnedValueInContext(GroupValidationContext<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);
ValidationHelper
.validateContext(context, new Jsr303ValidationCallback(context), isTreatMapsLikeBeans());
}
// 2. process sequences
for (List<Group> eachSeq : groups.getSequences()) {
for (Group current : eachSeq) {
context.setCurrentGroup(current);
ValidationHelper.validateContext(context, new Jsr303ValidationCallback(context),
isTreatMapsLikeBeans());
/**