mercredi 12 juin 2019

How to get list of methods defined in another class called from a given method in Java

I am planning to get list of methods defined in one package(CommonPackage) called by a class defined in another package (ServicePackage). For that, I need a to crawl a given method code and get the methods called outside of this class.

I have researched the Java reflections and was not able to find any solution for this. I also went through How to get the list of methods called from a method using reflection in C# and was not able to find any conclusive solution for JAVA specifically.

ClassA {
    private ClassB classB;
    public methodA1(){
        classB.methodB1();
    }
}

ClassB {

    public methodB1(){
      // Some code
    }
}

Expected: For ClassA.MethodA1, we get the list of methods called inside it. Output: ClassB.MethodB1





Aucun commentaire:

Enregistrer un commentaire