Thanks Ron

About this shaodw class...
Even if i have a shadow class for each original class
The set() advice still need runtime reflection or a switch statement
to set the shadow field ?!
I cant find too many examples on set()/get()


UPDATE
The map solution is easy and works

I thought about injecting a buddy *object* into each real object (i.e. no
new classes), using aspectj to skip all method execution, and only use the
fields for storage.
Is there some execution side effect which i wont be able to skip?

TIA


On Sat, Mar 9, 2013 at 4:20 PM, Ron DiFrango <
rdifra...@captechconsulting.com> wrote:

>  Without creating a aspectj shadow class that gets "injected" via an
> intertype declaration, I don't see a way to do it without reflection and/or
> using the map approached referenced in your post.
>
>  *Ron DiFrango*
> Director / Architect  |  CapTech
> (804) 855-9196  |  
> *rdifra...@captechconsulting.com<https://email4.captechventures.com/owa/UrlBlockedError.aspx>
> *
>   ------------------------------
> *From:* aspectj-users-boun...@eclipse.org [
> aspectj-users-boun...@eclipse.org] on behalf of y a [
> yaniv.azriel.sams...@gmail.com]
> *Sent:* Saturday, March 09, 2013 7:18 AM
> *To:* aspectj-users@eclipse.org
> *Subject:* [aspectj-users] Adding a new buddy field for EVERY existing
> field in a class ?!
>
>    I want an aspect to store the old value for each field set operation
>  So if a class has 3 long fields, i now need 3 new fields in the aspect
>
>  Is this possible ?!
> And is there a suitable ajc syntax to access such a buddy field in a set()
> advice ?
>
>  my example:
>
>  aspect to  "print" the field changes, but i need the new fields to
> "store" the values
>
> import java.io.*;
> import org.aspectj.lang.reflect.FieldSignature;
>
> aspect AspectField  {
>       before(long newval): set(long *) && args(newval) {
>
>          FieldSignature fs;
>          fs = (FieldSignature)thisJoinPointStaticPart.getSignature();
>          System.out.println(fs.getFieldType());
>          System.out.println("FIELD SET TO " + newval);
>
>           // i want to store the newval here in a "buddy field"
>        }
>   }
>
>  [[ Eventually i want all of this to be done statically with out
> reflection but one bridge at a time.. ]]
> [[
> http://stackoverflow.com/questions/6698203/exposing-previous-value-in-aspectj-set-pointcut-
>  this discussion stores all the fields in a single map - i dis like
> solution for performance.. ]]
>
>
>  TIA
>
> _______________________________________________
> 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

Reply via email to