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

Reply via email to