Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] obtaining aspect value from advice around field get pointcut

On Mar 13, 2008, at 8:05 AM, Christian.Hall@xxxxxxxxxxx wrote:

My inability to figure this out may be based on my weak understanding of how the get pointcut works in fhe first place, so I apologize in advance.

I have something like the following in a class:

Class Foo
private String field;

and within an aspect:

String around() : get(@MyAnnotation * *)

Change this to 

String around(MyAnnotation annotation) : get(@MyAnnotation * *.*) && @annotation(annotation) {
// do something with annotation.value();  // Get the string in the annotation.

Note that your get(...) had a little bug; the 3 '*' are the type, class, and field. 

Hope this helps.


How do I get the value of "aValue" from within the advice (marked //HERE)? I can get the target class and find fields, etc...but I need to know which field is the "target" (don't think it is considered a target from AspectJ's perspective) of the pointcut, etc.

This message contains information from Equifax Inc. which may be confidential and privileged. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify by e-mail postmaster@xxxxxxxxxxx.

aspectj-users mailing list

Dean Wampler, Ph.D.
dean at
See also:     AOP for Ruby         Design by Contract for Java5

Back to the top