Get method parameter values using AspectJ?
I am using AspectJ to capture method calls. Then I need to get the method name and the parameter values passed. Let's have the following example:
Line2D line = new Line2D.Double(lineStart, lineEnd); and graphics.draw(line);
I need to capture all calls to Graphics2D.draw(Shape). I have a pointcut that does this:
pointcut captureCallParameters(Shape name) : call(* *(Shape)) && args(name);
The problem is when I try to get the value of the parameter (Shape in this method). I get this parameter: java.awt.geom.Line2D$Double@596e1fb1
Instad I want to get the points for the shape which is a line in this case.
On the other hand I have also a pointcut that matches the construction of the new line mentioned above and I am able to get the parameters of that line. BUT I don't know how to relate the Draw method with that line constructor. I can have several constructors for Lines and I don't know which one of those Lines is drawn using the Draw(line) method.