summaryrefslogtreecommitdiffstats
path: root/tests/design/reflect/Simple.java
blob: 59a5b7ffedbcb191af9588c09ab111998c3a96ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import org.aspectj.lang.reflect.*;

public class Simple {
    public static void main(String[] args) {
	new Simple().foo("hi");
    }

    void foo(String s) {
	System.out.println("foo(" + s + ")");
    }

    char ch = 'a';
    int i = 0;
}

aspect A {
    before(): execution(* *.*(..)) {
	System.out.println(thisJoinPoint+ ", " + thisEnclosingJoinPointStaticPart);
    }
    before(): call(* *.*(..)) && !within(A) {
    	System.out.println("call: " + thisJoinPoint.getThis()+ ", " + thisEnclosingJoinPointStaticPart);
    }

    before(): set(* Simple.*) {
	//Object old = ((FieldAccessJoinPoint)thisJoinPoint).getValue();
	System.out.println(thisJoinPoint +", " + thisJoinPoint.getArgs());
    }
}