Read return value of method using javassist
I want to read the return value of a method and I have to pass it to the code that I insert using the .insertAfter method.
Example:
public String sayHello(){
return "1";
}
I want to add some code, say someClass.someMethod () using javassist.
method.insertAfter("someClass.someMethod(<how to add that value here>);");
Can anyone let me know how to do this?
[Edit] I cannot edit the body of the method because other code may be present. The above method is just an example.
+3
source to share