blob: e28eb1bdc078fc8d90c8c2b509704f6c0aa72562 (
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
29
30
|
import java.lang.reflect.Member;
import org.aspectj.lang.reflect.ConstructorSignature;
import org.aspectj.lang.reflect.FieldSignature;
import org.aspectj.lang.reflect.InitializerSignature;
public aspect SignatureImplAspect {
before () : (execution(ConstructorTest.new(..))) {
//thisJoinPointStaticPart.getSignature().getDeclaringType();
Member m = ((ConstructorSignature) thisJoinPointStaticPart
.getSignature()).getConstructor();
System.out.println(m.getName());
}
before() : set(int FieldTest.intField) {
//thisJoinPointStaticPart.getSignature().getDeclaringType();
Member m = ((FieldSignature) thisJoinPointStaticPart
.getSignature()).getField();
System.out.println(m.getName());
}
before() : staticinitialization(InitializerTest) {
//thisJoinPointStaticPart.getSignature().getDeclaringType();
Member m = ((InitializerSignature) thisJoinPointStaticPart
.getSignature()).getInitializer();
System.out.println(m.getName());
}
}
|