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.

FuzzilyMatchingAspect.aj 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. public aspect FuzzilyMatchingAspect {
  2. pointcut returnRefTypeSimpleOrArray() : execution(public MaybeMissing* MaybeMissing*.*());
  3. pointcut return1DimRefTypeArray() : execution(public MaybeMissing*[] MaybeMissing*.*());
  4. pointcut return2DimRefTypeArray() : execution(public MaybeMissing*[][] MaybeMissing*.*());
  5. // Return type 'MaybeMissing*' also matches array types due to the '*' at the end.
  6. // Therefore, explicitly exclude array pointcuts in order to only match the method returning the simple type.
  7. after() : returnRefTypeSimpleOrArray() && !return1DimRefTypeArray() && !return2DimRefTypeArray() {
  8. System.out.println(thisJoinPoint);
  9. }
  10. after() : return1DimRefTypeArray() {
  11. System.out.println(thisJoinPoint);
  12. }
  13. after() : return2DimRefTypeArray() {
  14. System.out.println(thisJoinPoint);
  15. }
  16. pointcut returnPrimitiveTypeSimpleOrArray() : execution(public in* MaybeMissing*.*());
  17. pointcut return1DimPrimitiveTypeArray() : execution(public in*[] MaybeMissing*.*());
  18. pointcut return2DimPrimitiveTypeArray() : execution(public in*[][] MaybeMissing*.*());
  19. // Return type 'in*' also matches array types due to the '*' at the end.
  20. // Therefore, explicitly exclude array pointcuts in order to only match the method returning the simple type.
  21. after() : returnPrimitiveTypeSimpleOrArray() && !return1DimPrimitiveTypeArray() && !return2DimPrimitiveTypeArray() {
  22. System.out.println(thisJoinPoint);
  23. }
  24. after() : return1DimPrimitiveTypeArray() {
  25. System.out.println(thisJoinPoint);
  26. }
  27. after() : return2DimPrimitiveTypeArray() {
  28. System.out.println(thisJoinPoint);
  29. }
  30. }