You should be able to get the current value if you use before advice. Of the top of my head (and hence with likely errors...):
before(MyClass object): set(* Class.foo) && this(object) && args(newValue) { System.out.println("Old: "+object.getFoo()); System.out.println("New: "+newValue); }
This assumes you have a "getFoo()" method. If so, be careful about advice on get(* Class.foo)! Alternatively, you could reference object.foo directly if foo is package private and the aspect is in the same package, etc.
dean
On Jun 16, 2008, at 7:55 AM, Ashley Williams wrote: Hi,
I would like to be able to inspect the current value of a field in addition to the value that is being assigned to it during the application of my advice. I am using the set pointcut designator in my advice and I can determine the name of the field using thisJoinPoint.getSignature().getName(), but not the value.
This is for an automatic event mechanism where I need name, oldValue and newValue.
Is this even possible?
Thanks - Ashley
--- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures. _______________________________________________ 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:
|