Excellent. That's what I'm doing. I was just wondering if there was a more
elegant way. Thank you.

On Fri, Feb 18, 2011 at 6:43 PM, Andy Clement <andrew.clem...@gmail.com>wrote:

> Hi,
>
> Unfortunately the relationship between the getter and the actual field
> being returned is not something we cleanly identify.  Right now you
> could either actually detect the field being accessed (with get()) or
> you could use a general execution pointcut (e.g. execution(* get*())
> and in the advice access the name of the method, determine the
> property from that, then check the annotation on that property.
>
> Andy
>
> On 18 February 2011 13:56, ramin <dou...@gmail.com> wrote:
> >
> > Hello All,
> >
> > I need some help with a pointcut for for a getter execution based on the
> > annotation of the related property. For example:
> >
> >
> > class A {
> >
> >  @SomeAnnotation
> >  String name;
> >
> >  Interger age;
> >
> >  @SomeAnnotation
> >  Integer weight;
> >
> >  String getName() { return name; }
> >
> >  Integer getAge() { return age; }
> >
> >  Integer getWeight() { return weight; }
> >
> > }
> >
> >
> > Now, I need a pointcut that should say "the execution of any getter of a
> > property that has "@SomeAnnotation" annotation". In this case "getName()"
> > and "getWeight()".
> >
> > Can someone help, please.
> >
> > Ramin
> > --
> > View this message in context:
> http://aspectj.2085585.n4.nabble.com/pointcut-for-for-a-getter-based-on-annotation-of-the-property-tp3313592p3313592.html
> > Sent from the AspectJ - users mailing list archive at Nabble.com.
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@eclipse.org
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>



-- 
Ramin
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to