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.

Complex.java 934B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. class CommonEntity {
  2. public void add(CommonEntity ce) {}
  3. public void remove(CommonEntity ce) {}
  4. }
  5. class ManageEntity {
  6. ManageEntity(CommonEntity ce) {
  7. }
  8. }
  9. abstract aspect Y {
  10. abstract pointcut entityAccessor(CommonEntity entity);
  11. before(CommonEntity entity): entityAccessor(entity) {}
  12. }
  13. aspect X extends Y {
  14. public pointcut entityAccessor1(CommonEntity entity)
  15. : (execution(* CommonEntity+.add*(CommonEntity+))
  16. || (execution(* CommonEntity+.remove*(CommonEntity+))))
  17. && within(CommonEntity+)
  18. && args(entity) && if(entity != null);
  19. public pointcut entityAccessor2(CommonEntity entity)
  20. : execution(ManageEntity.new(CommonEntity+, ..))
  21. && within(ManageEntity)
  22. && args(entity, ..)
  23. && if(entity != null);
  24. public pointcut entityAccessor(CommonEntity entity)
  25. : entityAccessor1(entity) || entityAccessor2(entity);
  26. }