[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-dev] adding an aspect at runtime to an object
|
#: Luca Ferrari changed the world a bit at a time by saying on 9/26/2005 10:35 AM :#
Hi,
I'm new to AOP and I've got a doubt due to a piece of code I've seen a
few time ago. The code was like the following:
Object o = new MyObject();
MyAspect a = new MyAspect();
a.addObject(o);
the idea was to use the aspect a to insert methods and variables into
the o object. But it sounds like the addObject method does not exists in
AspectJ, thus my question is if it's a feature removed (or another
language that I cannot find) and how I can merge an aspect with an
object at runtime. And what happen then? Is there a dynamic bytecode
manipulation?
Thanks,
Luca
Afaik, you cannot 'add'/'merge' an aspect at runtime. Instead, what can be done is
enabling/disabling an aspect.
The difference is that AJ should know where the aspect will be used (the joinpoints) when creating
the bytecode (for offline weaving) or at class load time (for load time weaving).
The above piece of code doesn't look to me as something of AJ. It rather looks like a proxy-based
solution, but I may be wrong :-s.
hth,
./alex
--
.the_mindstorm.