Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] pointcut for for a getter based on annotation of the property

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.clement@xxxxxxxxx> 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 <dousti@xxxxxxxxx> 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@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



--
Ramin

Back to the top