Estou tentando fazer um método que retorne um método de uma certa classe mas, não estou conseguindo lendo a API Reflection vi que é possível fazer isso…
Meu código:
public Method getMethod(String nameClass, String nameMethod) {
Method method = null;
for(IECommand invoker : invokers) {
if(invoker.getClass().getSimpleName().contains(nameClass)) {
try {
method = invoker.getClass().getMethod(nameMethod);
} catch (Exception ex) {
System.out.println("erro ao inserir porque:\n" + ex.getMessage());
}
}
}
return method;
}