lundi 25 mai 2020

Find method by signature in a class and invoking it

Is there a way to find a method in a class by its signature and invoke it runtime? Example in the class below:

class Person {
   public String getFullName(String first, String last) {
     return first + " " + last;
   }
   public String getValue(int i) {
      return ""
   }
}

can I use reflection to scan the Person class and return the method getFullName when searching all methods with (String, String) signature?





Aucun commentaire:

Enregistrer un commentaire