Hi Krishna.
Your questions indicate you want to do some kind of run-time analysis, logging, monitoring or debugging. This assumption is speculative though. Anyway, I have a feeling that maybe what you are trying to do might be overkill or at least suboptimal. If you could describe your goal or intent a bit to us, maybe we could suggest a simpler or more elegant way to solve your problem. For instance, I cannot imagine why you would need the source code during runtime. In your earlier example I also thought that you could work with argument binding via this(), target() and args() instead of creating arrays and iterating over them if just your pointcuts were a bit smarter or more precise.
Bottom line: AspectJ is for adding cross-cutting behaviour to your application. What kind of behaviour do you want?
Kind regards -- Alexander Kriegisch
Unfortunately the source code line is not captured in the joinpoint object, nor is the entire source encoded in the class file so that the relevant snippet could be extracted at runtime. You'd have to read the relevant source file and pull out the text you need.
cheers,
Andy
|