D
Donnie
Hi,
I am trying to learn Aspect Oriented Programming using AspectJ. I'm
having trouble getting the value of a class attribute in an aspect. In
the example listed below, I would like to retrieve the value of the
attribute x after the assignment.
public class Example {
public x;
public int setx (int y) {
this.x = y;
}
public static void main(String[] arguments) {
Example e = new Example();
e.setx(1);
}
}
public aspect AspectExample {
pointcut pcSetx() : execution(* Example.setx(..));
after() : pcSetx() {
int y;
y = //insert expression to retrieve the value of Example.x
System.out.println(y);
}
}
Thanks,
Donnie
I am trying to learn Aspect Oriented Programming using AspectJ. I'm
having trouble getting the value of a class attribute in an aspect. In
the example listed below, I would like to retrieve the value of the
attribute x after the assignment.
public class Example {
public x;
public int setx (int y) {
this.x = y;
}
public static void main(String[] arguments) {
Example e = new Example();
e.setx(1);
}
}
public aspect AspectExample {
pointcut pcSetx() : execution(* Example.setx(..));
after() : pcSetx() {
int y;
y = //insert expression to retrieve the value of Example.x
System.out.println(y);
}
}
Thanks,
Donnie