Hi, basically what i'm trying to do is to load dynamically a class with annotated methods, run the main method of the class then trigger some code when the annotated methods are called.
Exemple :
public myclass {
public static void myMethod1(){
mymethod2();
}
@trace
public static void myMethod2(){
... some code here ...
}
public static void main(String[] args) {
mymethod1();
}
}
the traceHandler.java program should be able to load any class, run its main method and print a "Method X called" when an annotated X method is called. i did the dynamic loading part but i can't find a way to "place listners" on the annotated methods.
The solutions that i've found involve using AOP or using proxies by making the target classes implement some interfaces (1) is there any other way to do the whole thing dynamically without getting into the details of the target class ?