mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-09-13 15:45:38 +02:00
34 lines
789 B
Java
34 lines
789 B
Java
|
package pack;
|
||
|
|
||
|
import org.aspectj.testing.Tester;
|
||
|
|
||
|
public aspect PackageWildcards {
|
||
|
pointcut fooCut(): call(String foo());
|
||
|
|
||
|
String around(): fooCut() && within(*) {
|
||
|
String result = proceed();
|
||
|
return result + ":fooCut";
|
||
|
}
|
||
|
|
||
|
pointcut allMethodsCut(): target(Foo) && call(!abstract String *(..));
|
||
|
|
||
|
String around(): allMethodsCut() {
|
||
|
String result = proceed();
|
||
|
return result + ":allMethodsCut";
|
||
|
}
|
||
|
|
||
|
public static void test() {
|
||
|
String message = new Foo().foo();
|
||
|
//System.out.println(message);
|
||
|
Tester.checkEqual(message, "foo:allMethodsCut:fooCut", "all advice active");
|
||
|
}
|
||
|
|
||
|
public static void main(String[] args) {
|
||
|
test();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class Foo {
|
||
|
String foo() { return "foo"; }
|
||
|
}
|