final Constructor<?> m = Constructor.class.cast(invocable);
parametersContext.setConstructor(m);
crossParameterContext.setConstructor(m);
}
final Groups groups = parametersContext.getGroups();
final List<ParameterDescriptor> parameterDescriptors = constructorDescriptor.getParameterDescriptors();
final ElementDescriptorImpl crossParamDescriptor = ElementDescriptorImpl.class.cast(constructorDescriptor.getCrossParameterDescriptor());
final Set<ConstraintDescriptor<?>> crossParamConstraints = crossParamDescriptor.getConstraintDescriptors();
crossParameterContext.setBean(parameterValues);
crossParameterContext.moveDown(rootNode);
crossParameterContext.moveDown("<cross-parameter>");
crossParameterContext.setKind(ElementKind.CROSS_PARAMETER);
parametersContext.moveDown(rootNode);
parametersContext.setParameters(parameterValues);
for (final Group current : groups.getGroups()) {
for (int i = 0; i < parameterValues.length; i++) {
final ParameterDescriptorImpl paramDesc = ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
parametersContext.setBean(parameterValues[i]);
parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
for (final ConstraintDescriptor<?> constraintDescriptor : paramDesc.getConstraintDescriptors()) {
final ConstraintValidation<?> validation = ConstraintValidation.class.cast(constraintDescriptor);
parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
validation.validateGroupContext(parametersContext);
}
parametersContext.moveUp(null, null);
}
for (final ConstraintDescriptor<?> d : crossParamConstraints) {
final ConstraintValidation<?> validation = ConstraintValidation.class.cast(d);
crossParameterContext.setCurrentGroup(crossParamDescriptor.mapGroup(current));
validation.validateGroupContext(crossParameterContext);
}
if (gps.length == 0 && parametersContext.getListener().getConstraintViolations().size() + crossParameterContext.getListener().getConstraintViolations().size() > 0) {
break;
}
}
for (final Group current : groups.getGroups()) {
for (int i = 0; i < parameterValues.length; i++) {
final ParameterDescriptorImpl paramDesc = ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
if (paramDesc.isCascaded() && parameterValues[i] != null) {
parametersContext.setBean(parameterValues[i]);
parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(), parameterValues[i].getClass());
parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext), isTreatMapsLikeBeans());
parametersContext.moveUp(null, null);
}
}
}
for (final List<Group> eachSeq : groups.getSequences()) {
for (final Group current : eachSeq) {
for (int i = 0; i < parameterValues.length; i++) {
final ParameterDescriptorImpl paramDesc = ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
parametersContext.setBean(parameterValues[i]);
parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
for (final ConstraintDescriptor<?> constraintDescriptor : paramDesc.getConstraintDescriptors()) {
final ConstraintValidation<?> validation = ConstraintValidation.class.cast(constraintDescriptor);
parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
validation.validateGroupContext(parametersContext);
}
parametersContext.moveUp(null, null);
}
for (final ConstraintDescriptor<?> d : crossParamConstraints) {
final ConstraintValidation<?> validation = ConstraintValidation.class.cast(d);
crossParameterContext.setCurrentGroup(crossParamDescriptor.mapGroup(current));
validation.validateGroupContext(crossParameterContext);
}
if (parametersContext.getListener().getConstraintViolations().size() + crossParameterContext.getListener().getConstraintViolations().size() > 0) {
break;
}
}
for (final Group current : eachSeq) {
for (int i = 0; i < parameterValues.length; i++) {
final ParameterDescriptorImpl paramDesc = ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
if (paramDesc.isCascaded() && parameterValues[i] != null) {
parametersContext.setBean(parameterValues[i]);
parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(), parameterValues[i].getClass());
parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext), isTreatMapsLikeBeans());
parametersContext.moveUp(null, null);
}
}
}
}
if (constructorDescriptor.isCascaded()) {
if (parametersContext.getValidatedValue() != null) {
initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(), parametersContext.getValidatedValue().getClass());
for (final Group current : groups.getGroups()) {
parametersContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext), isTreatMapsLikeBeans());
}
for (final List<Group> eachSeq : groups.getSequences()) {
for (final Group current : eachSeq) {
parametersContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext), isTreatMapsLikeBeans());
if (!parametersContext.getListener().isEmpty()) {
break;
}
}
}
}
if (crossParameterContext.getValidatedValue() != null) {
initMetaBean(crossParameterContext, factoryContext.getMetaBeanFinder(), crossParameterContext.getValidatedValue().getClass());
for (final Group current : groups.getGroups()) {
crossParameterContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
ValidationHelper.validateContext(crossParameterContext, new JsrValidationCallback(crossParameterContext), isTreatMapsLikeBeans());
}
for (final List<Group> eachSeq : groups.getSequences()) {
for (final Group current : eachSeq) {
crossParameterContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
ValidationHelper.validateContext(crossParameterContext, new JsrValidationCallback(crossParameterContext), isTreatMapsLikeBeans());
if (!crossParameterContext.getListener().isEmpty()) {
break;