Map<Method, List<Object>> nmatches = new HashMap<Method, List<Object>>();
for (Method mth : methods) {
boolean found = true;
List<Object> match = new ArrayList<Object>();
for (int i = 0; i < args.size(); i++) {
ReifiedType argType = new GenericType(mth.getGenericParameterTypes()[i]);
if (types.get(i) != null && !argType.getRawClass().equals(types.get(i).getRawClass())) {
found = false;
break;
}
if (!AggregateConverter.isAssignable(args.get(i), argType)) {
found = false;
break;
}
try {
match.add(convert(args.get(i), mth.getGenericParameterTypes()[i]));
} catch (Throwable t) {
found = false;
break;
}
}
if (found) {
nmatches.put(mth, match);
}
}
if (nmatches.size() > 0) {
matches = nmatches;
}
}
// Find a direct match with conversion
if (matches.size() != 1) {
Map<Method, List<Object>> nmatches = new HashMap<Method, List<Object>>();
for (Method mth : methods) {
boolean found = true;
List<Object> match = new ArrayList<Object>();
for (int i = 0; i < args.size(); i++) {
ReifiedType argType = new GenericType(mth.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);