public class SimpleLoadTimeWeaver extends java.lang.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(java.lang.instrument.ClassFileTransformer transformer)
Add a
ClassFileTransformer to be applied by this
LoadTimeWeaver . |
java.lang.ClassLoader |
getInstrumentableClassLoader()
Return a
ClassLoader that supports instrumentation
through AspectJ-style load-time weaving based on user-defined
ClassFileTransformers . |
java.lang.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(java.lang.instrument.ClassFileTransformer transformer)
LoadTimeWeaver
ClassFileTransformer
to be applied by this
LoadTimeWeaver
.addTransformer
in interface LoadTimeWeaver
transformer
- the ClassFileTransformer
to addpublic java.lang.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 java.lang.ClassLoader getThrowawayClassLoader()
SimpleThrowawayClassLoader
.getThrowawayClassLoader
in interface LoadTimeWeaver
ClassLoader
; should return
a new instance for each call, with no existing state