I read the name of the calling method and the content of the input parameter from the file. I want to call a method with reflection, but I don't specify the specific type. Can I do that?
public class FunctionA {
public String printf(String s) {
return "functionA:" + s;
}
}
Method method = clazz.getMethod("printf");
// Method method = clazz.getMethod(invocation.getMethodName(), paramClasses);
return method.invoke(clazzInstance, paramObjects);
Aucun commentaire:
Enregistrer un commentaire