Is there a way in Java using reflection or any, to call a method or a class when a custom method is called.
I have a packed library.jar, in which Foo.class has method doThat(String a, MyObject b)
public class Foo {
public Object doThat(String a, MyObject b) {
// do something
return null;
}
}
I need a trigger my custom method Bar#doThis, when Foo#doThat is called.
public class Bar {
public boolean doThis(String a, MyObject b) {
// did it.
return true;
}
}
I will not be able to extract the jar and inject listeners. Foo.class is as similar as java.util.ArrayList or final class java.util.zip.ZipCoder
Aucun commentaire:
Enregistrer un commentaire