for (int i = 0; i < size / 2; i++) {
Class<?> oldType = parameterTypes[i];
if (oldParameters.size() == 0) {
// the first parameter is the body
Expression oldBody = ExpressionBuilder.mandatoryBodyExpression(oldType);
ParameterInfo info = new ParameterInfo(i, oldType, null, oldBody);
oldParameters.add(info);
} else if (oldParameters.size() == 1) {
// the 2nd parameter is the headers
Expression oldHeaders = ExpressionBuilder.headersExpression();
ParameterInfo info = new ParameterInfo(i, oldType, null, oldHeaders);
oldParameters.add(info);
} else if (oldParameters.size() == 2) {
// the 3rd parameter is the properties
Expression oldProperties = ExpressionBuilder.propertiesExpression();
ParameterInfo info = new ParameterInfo(i, oldType, null, oldProperties);
oldParameters.add(info);
}
}
for (int i = size / 2; i < size; i++) {
Class<?> newType = parameterTypes[i];
if (newParameters.size() == 0) {
// the first parameter is the body
Expression newBody = ExpressionBuilder.mandatoryBodyExpression(newType);
ParameterInfo info = new ParameterInfo(i, newType, null, newBody);
newParameters.add(info);
} else if (newParameters.size() == 1) {
// the 2nd parameter is the headers
Expression newHeaders = ExpressionBuilder.headersExpression();
ParameterInfo info = new ParameterInfo(i, newType, null, newHeaders);
newParameters.add(info);
} else if (newParameters.size() == 2) {
// the 3rd parameter is the properties
Expression newProperties = ExpressionBuilder.propertiesExpression();
ParameterInfo info = new ParameterInfo(i, newType, null, newProperties);
newParameters.add(info);
}
}
return new AggregationStrategyMethodInfo(camelContext, type, method, oldParameters, newParameters);