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.

CaseB.java 635B

12345678910111213141516171819202122232425262728
  1. import org.aspectj.lang.annotation.*;
  2. public class CaseB {
  3. public static void main(String[]argv) {
  4. CaseB cb = new CaseB();
  5. ((I)cb).methodOne(); // will only succeed if mixin applied
  6. }
  7. }
  8. aspect X {
  9. // TESTING: non static factory method, will need aspectOf() calling on
  10. // the aspect before the factory is called
  11. @DeclareMixin("CaseB")
  12. public I createImplementation() {
  13. System.out.println("Delegate factory invoked");
  14. return new Implementation();
  15. }
  16. }
  17. interface I {
  18. void methodOne();
  19. }
  20. class Implementation implements I {
  21. public void methodOne() {
  22. System.out.println("methodOne running");
  23. }
  24. }