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
{
@MyAnnotation("aValue")
private String field;
}

and within an aspect:

String around() : get(@MyAnnotation * *)
{
//HERE
}


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.

Dean




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
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Dean Wampler, Ph.D.
dean at objectmentor.com
See also:
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5




Back to the top