Something like this: pointcut methodOfInterest(MyAnnotation anno,Object instance): execution(@MyAnnotation * get*(..)) && @annotation(anno) && this(instance);
Object around(MyAnnotation anno,Object instance): methodOfInterest(anno, instance) { Field f = instance.getClass().getDeclaredField(anno.property); // f.setAccessible(true) Object value = f.get(instance); if (value==376.125) { return proceed(); } else { return null; } } If you know the Object is of a specific type (or limited set of types, or you can use a common supertype), you can perhaps lose the reflection. cheers Andy On 13 April 2011 17:13, CRANFORD, CHRIS <chris.cranf...@setech.com> wrote: > I need to annotate a property on a class or it's "getter" method like > the following: > > @MyAnnotation(property="myField") > public Double getPrice() { > return price; > } > > The goal of the annotation is to perform an around advice where it > inspects myField's value on the annotated method's class or property's > class checks whether the value of myField is a specific value and if so; > it returns the value from proceed() otherwise it is to default to > returning null instead. > > Can someone show me how to accomplish this or is this not possible? > > _______________________________________________ > 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