The Spring Framework

org.springframework.instrument.classloading
Interface LoadTimeWeaver

All Known Implementing Classes:
GlassFishLoadTimeWeaver, InstrumentationLoadTimeWeaver, OC4JLoadTimeWeaver, ReflectiveLoadTimeWeaver, SimpleLoadTimeWeaver

public interface LoadTimeWeaver

Defines the contract for adding one or more ClassFileTransformers to a ClassLoader - typically the current context class loader.

Implementations may of course provide their own class loader as well.

Since:
2.0
Author:
Rod Johnson, Costin Leau

Method Summary
 void addTransformer(ClassFileTransformer transformer)
          Add a class file transformer to be applied by this load-time weaver.
 ClassLoader getInstrumentableClassLoader()
          Return a class loader that supports instrumentation through AspectJ-style load-time weaving based on user-defined ClassFileTransformers.
 ClassLoader getThrowawayClassLoader()
          Return a throwaway class loader, enabling classes to be loaded and inspected without affecting the parent class loader.
 

Method Detail

addTransformer

void addTransformer(ClassFileTransformer transformer)
Add a class file transformer to be applied by this load-time weaver.

Parameters:
transformer - the class file transformer to add

getInstrumentableClassLoader

ClassLoader getInstrumentableClassLoader()
Return a class loader that supports instrumentation through AspectJ-style load-time weaving based on user-defined ClassFileTransformers.

May be the current class loader, or a class loader created by this LoadTimeWeaver instance.

Returns:
a class loader that supports instrumentation through AspectJ-style load-time weaving based on user-defined ClassFileTransformers

getThrowawayClassLoader

ClassLoader getThrowawayClassLoader()
Return a throwaway class loader, enabling classes to be loaded and inspected without affecting the parent class loader.

Should not return the same instance of the ClassLoader returned from an invocation of getInstrumentableClassLoader().

Returns:
a temporary throwaway class loader; should return a new instance for each call, with no existing state

The Spring Framework

Copyright © 2002-2007 The Spring Framework.