if (!cache.containsKey(method)) {
Pojo pojo = method.getAnnotation(Pojo.class);
cache.put(method, pojo == null ? null : targetDesc.getMethod(pojo.value()));
}
ClassMethod cm = cache.get(method);
if (cm != null) {
Object[] modifiedArguments = null;
if (cm.getParameterTypes().length == 0) {
modifiedArguments = CollectionUtil.EMPTY_OBJECT_ARRAY;
} else if (cm.getParameterTypes().length == 1 && cm.getParameterTypes()[0] == method.getDeclaringClass()) {
modifiedArguments = new Object[] { defaultTarget };
} else if (cm.compareArguments(args) == ArgumentMatch.FUNCTIONAL) {
modifiedArguments = args;
} else {
throw new IllegalArgumentException("Cannot call method appropriately");
}
return interceptor.invoke(target, cm.getJavaMember(), modifiedArguments);
} else {
return interceptor.invoke(defaultTarget, method, args);
}
}