Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Applying aspects programmatically

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Oleg Lebedev wrote:
> Here is an example. I have a class, which uses java.util.Random. In
> order to test this class I want to replace all Random objects with
> my Randomizer objects. I have an aroun() advice, which does just
> that. However, I want to be able to apply this advice and runtime
> when
> testing the class instead of the compile time.   
> 
> How can I do this?

Hi, Oleg.


The only approach I am aware of, which can currently actually add
pointcuts and advice during runtime is the Steamloom virtual machine.
I am pretty sure, one *has* to have VM support for this. All other
approaches, also AspectWerkz (at least the last version I have seen),
need to prepare classes (they weave hooks into the code) in order to
apply aspects at runtime.

You might want to have a look at "Phili Mayer, A Classification of
Dynamic AO Systems" [1].

Cheers,
Eric

[1]
http://aop.pmayer.net/images/3/39/A_Classification_of_Dynamic_AO_Syste
ms_Final_30.01.2005_.pdf

- -- 
Eric Bodden
Chair I2 for Programming Languages and Program Analysis
RWTH Aachen University

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3

iQA/AwUBQoWw/8wiFCm7RlWCEQKShgCeNntO0lB40pVGvQejirQb23wd3mAAniTp
JByNkoUApKISS8GtU1d3GyXA
=Zl8m
-----END PGP SIGNATURE-----




Back to the top