[
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
|
Thanks for the fast response.
I got this to work with two notes:
- I had to make the aspect use runtime retention, which should not be required according to the docs which say this is only the case for args, target and this.
- I did not need your correction to the get pointcut...assume because one of these is optional in certain circumstances...I often have trouble figuring out when I need an asterisk and when I don't, but this works with just two!
Dean Wampler <dean@xxxxxxxxxxxxxxxxxxxxx>
Dean Wampler <dean@xxxxxxxxxxxxxxxxxxxxx> Sent by: aspectj-users-bounces@xxxxxxxxxxx03/13/2008 10:46 AM Please respond to aspectj-users@xxxxxxxxxxx |
|
|
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.DeanDean Wampler, Ph.D.dean at objectmentor.comhttp://www.objectmentor.comSee also:http://www.aspectprogramming.com AOP advocacy sitehttp://aquarium.rubyforge.org AOP for Rubyhttp://www.contract4j.org Design by Contract for Java5_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users