1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import org.aspectj.lang.annotation.*;
- import java.lang.annotation.*;
- import java.lang.reflect.*;
- import org.aspectj.lang.*;
-
- @Aspect("perthis(transactional())")
- public class Code3 {
- @Pointcut("execution(@Transactional * * (..))")
- public void transactional() { }
-
- @Before("execution(* *(..))")
- public void m(JoinPoint.StaticPart thisJoinPointStaticPart) {
- System.out.println(thisJoinPointStaticPart);
- }
-
- public static void main(String[] args) {
- new AAA().m();
- new BBB().m();
- new CCC().m();
- }
-
- }
-
- aspect XXX {
- @Transactional public void CCC.m() {}
- }
-
- class AAA {
- public void m() { }
- }
-
- class BBB {
- public void m() { }
- }
-
- class CCC {
- }
-
-
- @Retention(RetentionPolicy.RUNTIME) @interface Transactional {}
|