Map<Constructor, List<Object>> nmatches = new HashMap<Constructor, List<Object>>();
for (Constructor cns : constructors) {
boolean found = true;
List<Object> match = new ArrayList<Object>();
for (int i = 0; i < args.size(); i++) {
ReifiedType argType = new GenericType(cns.getGenericParameterTypes()[i]);
if (types.get(i) != null && !argType.getRawClass().equals(types.get(i).getRawClass())) {
found = false;
break;
}
//If the arg is an Unwrappered bean then we need to do the assignment check against the
//unwrappered bean itself.
Object arg = args.get(i);
Object argToTest = arg;
if(arg instanceof UnwrapperedBeanHolder)
argToTest = ((UnwrapperedBeanHolder)arg).unwrapperedBean;
if (!AggregateConverter.isAssignable(argToTest, argType)) {
found = false;
break;
}
try {
match.add(convert(arg, cns.getGenericParameterTypes()[i]));
} catch (Throwable t) {
found = false;
break;
}
}
if (found) {
nmatches.put(cns, match);
}
}
if (nmatches.size() > 0) {
matches = nmatches;
}
}
// Find a direct match with conversion
if (matches.size() != 1) {
Map<Constructor, List<Object>> nmatches = new HashMap<Constructor, List<Object>>();
for (Constructor cns : constructors) {
boolean found = true;
List<Object> match = new ArrayList<Object>();
for (int i = 0; i < args.size(); i++) {
ReifiedType argType = new GenericType(cns.getGenericParameterTypes()[i]);
if (types.get(i) != null && !argType.getRawClass().equals(types.get(i).getRawClass())) {
found = false;
break;
}
try {
Object val = convert(args.get(i), argType);