Interface LoadTimeWeaver
- All Known Implementing Classes:
DefaultContextLoadTimeWeaver
,GlassFishLoadTimeWeaver
,InstrumentationLoadTimeWeaver
,JBossLoadTimeWeaver
,ReflectiveLoadTimeWeaver
,SimpleLoadTimeWeaver
,TomcatLoadTimeWeaver
public interface LoadTimeWeaver
Defines the contract for adding one or more
ClassFileTransformers
to a ClassLoader
.
Implementations may operate on the current context ClassLoader
or expose their own instrumentable ClassLoader
.
- Since:
- 2.0
- Author:
- Rod Johnson, Costin Leau
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTransformer
(ClassFileTransformer transformer) Add aClassFileTransformer
to be applied by thisLoadTimeWeaver
.Return aClassLoader
that supports instrumentation through AspectJ-style load-time weaving based on user-definedClassFileTransformers
.Return a throwawayClassLoader
, enabling classes to be loaded and inspected without affecting the parentClassLoader
.
-
Method Details
-
addTransformer
Add aClassFileTransformer
to be applied by thisLoadTimeWeaver
.- Parameters:
transformer
- theClassFileTransformer
to add
-
getInstrumentableClassLoader
ClassLoader getInstrumentableClassLoader()Return aClassLoader
that supports instrumentation through AspectJ-style load-time weaving based on user-definedClassFileTransformers
.May be the current
ClassLoader
, or aClassLoader
created by thisLoadTimeWeaver
instance.- Returns:
- the
ClassLoader
which will expose instrumented classes according to the registered transformers
-
getThrowawayClassLoader
ClassLoader getThrowawayClassLoader()Return a throwawayClassLoader
, enabling classes to be loaded and inspected without affecting the parentClassLoader
.Should not return the same instance of the
ClassLoader
returned from an invocation ofgetInstrumentableClassLoader()
.- Returns:
- a temporary throwaway
ClassLoader
; should return a new instance for each call, with no existing state
-