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.

A1.java 714B

12345678910111213141516171819202122232425262728293031
  1. // Simple - don't attempt to alter target for proceed, just change the arg
  2. import org.aspectj.lang.ProceedingJoinPoint;
  3. import org.aspectj.lang.annotation.*;
  4. @Aspect
  5. public class A1 {
  6. @Around("call(void M.method(String)) && args(p)")
  7. public void a( ProceedingJoinPoint pjp, String p) throws Throwable {
  8. System.err.println("advice from ataj aspect");
  9. pjp.proceed( new Object[] { "faked" } );
  10. }
  11. public static void main(String []argv) {
  12. M.main(argv);
  13. }
  14. }
  15. class M {
  16. String prefix;
  17. public M(String prefix) { this.prefix = prefix; }
  18. public static void main( String[] args ) {
  19. M m = new M(">");
  20. m.method("real");
  21. }
  22. public void method(String s) { System.err.println(s); }
  23. }