I am trying to get a method no matter what parameters this method takes (there is currently no method overload, and this will not happen in the future). The only possible solution I could come up with was
private Method getMethod(Class<?> clas, String methodName) {
try {
Method[] methods = clas.getMethods();
for (Method method : methods) {
if (method.getName().equalsIgnoreCase(methodName)) {
return method;
}
}
} catch (SecurityException e) {
e.printStackTrace();
}
return null;
}
What I want to ask is there a way to get a method regardless of its parameters? I looked at clas.getMethod ("methodName", parameters), and if I provide nullthere, it will try to extract a method that has no parameters. This will not be the case.
Any ideas?
, , . , , . , ignoreCase, , ( ), . , , .