blob: 63260a7cdbf925b4abed8c98a78820eda12556e7 (
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
31
32
33
34
35
36
37
38
39
40
41
42
|
import org.aspectj.testing.Tester;
public aspect WildNames {
public static void main(String[] args) { test(); }
public static void test() {
C c = new C();
c.getFoo(); c.getBar();
Tester.check("getFoo"); Tester.check("getBar");
c.fooGetter(); c.barGetter();
Tester.check("fooGetter"); Tester.check("barGetter");
c.prefixFooSuffix(); c.prefixBarSuffix();
Tester.check("prefixFooSuffix"); Tester.check("prefixBarSuffix");
}
/*static*/ after() returning (String s): execution(String get*()) {
Tester.checkEqual("get*", s);
Tester.note(thisJoinPoint.getSignature().getName());
}
/*static*/ after() returning (String s): execution(String *Getter()) {
Tester.checkEqual("*Getter", s);
Tester.note(thisJoinPoint.getSignature().getName());
}
/*static*/ after() returning (String s): execution(String prefix*Suffix()) {
Tester.checkEqual("prefix*Suffix", s);
Tester.note(thisJoinPoint.getSignature().getName());
}
}
class C {
public String getFoo() { return "get*"; }
public String getBar() { return "get*"; }
public String fooGetter() { return "*Getter"; }
public String barGetter() { return "*Getter"; }
public String prefixFooSuffix() { return "prefix*Suffix"; }
public String prefixBarSuffix() { return "prefix*Suffix"; }
}
|