[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Help required to define pointcut for getters returning a specific type.

Hello Everybody,


I am trying to define a pointcut to intercept all the calls to getter methods of following types.


public class A extends AbstractBusinessEntity{

            private String test1;

            private List<B> bCollection;

            private C c;

            public String getTest1(){                                     // I don’t want to intercept these getters

                        return this.test1;


            public List<B> getBCollection(){                         // I want to intercept all such getters

                        return this.bCollection;


public C getC(){

            return this.c;



public class B extends AbstractBusinessEntity{

            public String test2;





public class C extends AbstractBusinessEntity{

            public String test3;






I am trying to define the pointcut as below


      public pointcut auditCompositeGetter(AbstractBusinessEntity entity) :

(execution (public AbstractBusinessEntity AbstractBusinessEntity +.get*())

|| execution (public Collection<AbstractBusinessEntity> AbstractBusinessEntity +.get*()))

                  && target(entity);


However at the advice definition it gives a warning saying advice is not applied since it didn’t match. Could anyone please let me know if there is any problem with the pointcut definition above?


Thanks and Regards,


 Legal Notice: This transmission, including any attachments, is confidential, proprietary, and may be privileged. It is intended solely for the intended recipient. If you are not the intended recipient, you have  received this transmission in error and you are hereby advised that any review, disclosure, copying, distribution, or use of this transmission, or any of the information included therein, is unauthorized and strictly prohibited. If you have received this transmission in error, please immediately notify the sender by reply and permanently delete all copies of this transmission and its attachments