I am writing a parser that takes as an input a file like :
Testabc:10 20
Testxyz:100 30
This file is the format ClassName:LineNumber TimeTakenToExecute it. My parser takes a bunch of these files and gets the method called at ClassName:LineNumber and outputs another file of the format :
Say line 9 and 10 of Testabc looks like :
Utils utils = new Utils();
utils.getName()
then the output of my parser should be :
Utils.getName() 20
Manager.getPassword() 30
I can get the string attached to the line in a class (i.e from Testabc:10 I can get utils.getName()).
I can also get a list of methods in my code directory and map it to a class (Eg map : getName:Utils). But it will not work for duplicate method names/overridden methods/classes that extend interfaces (In this case I want the method to show the implemented class name and not the interface name).
Is there any way I can get this information through reflection? i.e., get the class name and method name from a line of code?
Aucun commentaire:
Enregistrer un commentaire