public class SimpleLoadTimeWeaver extends Object implements LoadTimeWeaver
LoadTimeWeaver
that builds and exposes a
SimpleInstrumentableClassLoader
.
Mainly intended for testing environments, where it is sufficient to
perform all class transformation on a newly created
ClassLoader
instance.
getInstrumentableClassLoader()
,
SimpleInstrumentableClassLoader
,
ReflectiveLoadTimeWeaver
Constructor and Description |
---|
SimpleLoadTimeWeaver()
Create a new
SimpleLoadTimeWeaver for the current context
ClassLoader . |
SimpleLoadTimeWeaver(SimpleInstrumentableClassLoader classLoader)
Create a new
SimpleLoadTimeWeaver for the given
ClassLoader . |
Modifier and Type | Method and Description |
---|---|
void |
addTransformer(ClassFileTransformer transformer)
Add a
ClassFileTransformer to be applied by this
LoadTimeWeaver . |
ClassLoader |
getInstrumentableClassLoader()
Return a
ClassLoader that supports instrumentation
through AspectJ-style load-time weaving based on user-defined
ClassFileTransformers . |
ClassLoader |
getThrowawayClassLoader()
This implementation builds a
SimpleThrowawayClassLoader . |
public SimpleLoadTimeWeaver()
SimpleLoadTimeWeaver
for the current context
ClassLoader
.SimpleInstrumentableClassLoader
public SimpleLoadTimeWeaver(SimpleInstrumentableClassLoader classLoader)
SimpleLoadTimeWeaver
for the given
ClassLoader
.classLoader
- the ClassLoader
to build a simple
instrumentable ClassLoader
on top ofpublic void addTransformer(ClassFileTransformer transformer)
LoadTimeWeaver
ClassFileTransformer
to be applied by this
LoadTimeWeaver
.addTransformer
in interface LoadTimeWeaver
transformer
- the ClassFileTransformer
to addpublic ClassLoader getInstrumentableClassLoader()
LoadTimeWeaver
ClassLoader
that supports instrumentation
through AspectJ-style load-time weaving based on user-defined
ClassFileTransformers
.
May be the current ClassLoader
, or a ClassLoader
created by this LoadTimeWeaver
instance.
getInstrumentableClassLoader
in interface LoadTimeWeaver
ClassLoader
which will expose
instrumented classes according to the registered transformerspublic ClassLoader getThrowawayClassLoader()
SimpleThrowawayClassLoader
.getThrowawayClassLoader
in interface LoadTimeWeaver
ClassLoader
; should return
a new instance for each call, with no existing state