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.

Code3.java 758B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import org.aspectj.lang.annotation.*;
  2. import java.lang.annotation.*;
  3. import java.lang.reflect.*;
  4. import org.aspectj.lang.*;
  5. @Aspect("perthis(transactional())")
  6. public class Code3 {
  7. @Pointcut("execution(@Transactional * * (..))")
  8. public void transactional() { }
  9. @Before("execution(* *(..))")
  10. public void m(JoinPoint.StaticPart thisJoinPointStaticPart) {
  11. System.out.println(thisJoinPointStaticPart);
  12. }
  13. public static void main(String[] args) {
  14. new AAA().m();
  15. new BBB().m();
  16. new CCC().m();
  17. }
  18. }
  19. aspect XXX {
  20. @Transactional public void CCC.m() {}
  21. }
  22. class AAA {
  23. public void m() { }
  24. }
  25. class BBB {
  26. public void m() { }
  27. }
  28. class CCC {
  29. }
  30. @Retention(RetentionPolicy.RUNTIME) @interface Transactional {}