You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PackageWildcards.java 789B

123456789101112131415161718192021222324252627282930313233
  1. package pack;
  2. import org.aspectj.testing.Tester;
  3. public aspect PackageWildcards {
  4. pointcut fooCut(): call(String foo());
  5. String around(): fooCut() && within(*) {
  6. String result = proceed();
  7. return result + ":fooCut";
  8. }
  9. pointcut allMethodsCut(): target(Foo) && call(!abstract String *(..));
  10. String around(): allMethodsCut() {
  11. String result = proceed();
  12. return result + ":allMethodsCut";
  13. }
  14. public static void test() {
  15. String message = new Foo().foo();
  16. //System.out.println(message);
  17. Tester.checkEqual(message, "foo:allMethodsCut:fooCut", "all advice active");
  18. }
  19. public static void main(String[] args) {
  20. test();
  21. }
  22. }
  23. class Foo {
  24. String foo() { return "foo"; }
  25. }