You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SimpleAround.java 763B

123456789101112131415161718192021222324252627282930
  1. import org.aspectj.lang.reflect.*;
  2. public class SimpleAround {
  3. public static void main(String[] args) {
  4. new SimpleAround().foo("hi");
  5. }
  6. void foo(String s) {
  7. System.out.println("foo(" + s + ")");
  8. }
  9. }
  10. aspect A {
  11. static around(String x) returns void: executions(void *.foo(x)) {
  12. System.out.println("calling foo with: " + x +", " + thisStaticJoinPoint);
  13. proceed(x);
  14. System.out.println("returning from: " + thisJoinPoint); //((CallJoinPoint)thisJoinPoint).getParameters()[0]);
  15. }
  16. static before(): executions(void *.foo(String)) {
  17. System.out.println("entering: " + thisJoinPoint);
  18. }
  19. //static around() returns void: calls(void *.foo(String)) {
  20. //System.out.println(thisStaticJoinPoint);
  21. //proceed();
  22. //}
  23. }