You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by "Ganesan, Dharmalingam" <Dh...@iese.fraunhofer.de> on 2004/12/26 12:33:25 UTC

BCEL: Method Invocation Redirection

Hi,

> I'm new to BCEL. I started using BCEL to do run-time analysis. I have
> question: How to redirect a method invocation to a different method.
> 
> 
> /* Original code */
> public class MyClass {
> 
>     public void start() {
> 
>     }
> 
>     public void kick() {
> 	start();
>     }
> }
> 
> 
> /* New code after redirecting start() method to start(Thread)  should
> look as below */
> 
> public class MyClass {
> 
>     public void start() {
> 
>     }
> 
>     public void start(Thread callerThread) {
>           start();
>     }
> 
>     public void kick() {
>            start(Thread.currentThread());
>     }
> }
> 
> My question is how to do redirection with the kick() method. That is,
> the kick() should call start(Thread), instead of start().
> 
> I learned how to introduce a new method into java class. Therefore, It
> is enough if you can explain me about the redirection.
> 
> Thank you in advance.
> 
> Best Regards,
> Dharma
>