The Spring Framework

org.springframework.instrument.classloading
Class SimpleLoadTimeWeaver

java.lang.Object
  extended by org.springframework.instrument.classloading.SimpleLoadTimeWeaver
All Implemented Interfaces:
LoadTimeWeaver

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.

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller
See Also:
getInstrumentableClassLoader(), SimpleInstrumentableClassLoader, ReflectiveLoadTimeWeaver

Constructor Summary
SimpleLoadTimeWeaver()
          Create a new SimpleLoadTimeWeaver for the current context class loader.
SimpleLoadTimeWeaver(SimpleInstrumentableClassLoader classLoader)
          Create a new SimpleLoadTimeWeaver for the given class loader.
 
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()
          This implementation builds a SimpleThrowawayClassLoader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLoadTimeWeaver

public SimpleLoadTimeWeaver()
Create a new SimpleLoadTimeWeaver for the current context class loader.


SimpleLoadTimeWeaver

public SimpleLoadTimeWeaver(SimpleInstrumentableClassLoader classLoader)
Create a new SimpleLoadTimeWeaver for the given class loader.

Parameters:
classLoader - the ClassLoader to build an simple instrumentable ClassLoader on top of
Method Detail

addTransformer

public void addTransformer(ClassFileTransformer transformer)
Description copied from interface: LoadTimeWeaver
Add a class file transformer to be applied by this load-time weaver.

Specified by:
addTransformer in interface LoadTimeWeaver
Parameters:
transformer - the class file transformer to add

getInstrumentableClassLoader

public ClassLoader getInstrumentableClassLoader()
Description copied from interface: LoadTimeWeaver
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.

Specified by:
getInstrumentableClassLoader in interface LoadTimeWeaver
Returns:
a class loader that supports instrumentation through AspectJ-style load-time weaving based on user-defined ClassFileTransformers

getThrowawayClassLoader

public ClassLoader getThrowawayClassLoader()
This implementation builds a SimpleThrowawayClassLoader.

Specified by:
getThrowawayClassLoader in interface LoadTimeWeaver
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.