Hi Mayank,
Sorry I couldn't help you. You might want to take a look at the byteman project (http://www.jboss.org/byteman), which lets you inject code into existing code. I know very little about it, but it sounds like it might be useful.
Good luck,
Ron