Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Bind this and target on execution and change it with proceed
  2. import org.aspectj.lang.ProceedingJoinPoint;
  3. import org.aspectj.lang.annotation.*;
  4. @Aspect
  5. public class A9 {
  6. M newM2 = new M("2");
  7. M newM3 = new M("3");
  8. @Around("execution(void M.method(String)) && args(p) && this(t) && target(t2)")
  9. public void a( ProceedingJoinPoint pjp, M t,M t2,String p) throws Throwable {
  10. System.err.println("advice from ataj aspect");
  11. pjp.proceed(new Object[]{newM2,newM3,"faked"});
  12. }
  13. public static void main(String []argv) {
  14. M.main(argv);
  15. }
  16. }
  17. class M {
  18. String prefix;
  19. public M(String prefix) { this.prefix = prefix; }
  20. public static void main( String[] args ) {
  21. M m = new M("1");
  22. m.methodCaller("real");
  23. }
  24. public void methodCaller(String param) {
  25. method(param);
  26. }
  27. public void method(String s) { System.err.println(prefix+s); }
  28. }