The Spring Framework

## org.springframework.instrument.classloading
Class SimpleLoadTimeWeaver

    java.lang.Object
      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 `ClassLoader`.
`SimpleLoadTimeWeaver(SimpleInstrumentableClassLoader classLoader)` Create a new `SimpleLoadTimeWeaver` for the given `ClassLoader`.

Method Summary
`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`.

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 `ClassLoader`.

  See Also:
    `SimpleInstrumentableClassLoader`

### SimpleLoadTimeWeaver

    public SimpleLoadTimeWeaver(SimpleInstrumentableClassLoader classLoader)

  Create a new `SimpleLoadTimeWeaver` for the given `ClassLoader`.

  Parameters:
    `classLoader` - the `ClassLoader` to build a simple instrumentable `ClassLoader` on top of

Method Detail

### addTransformer

    public void addTransformer(ClassFileTransformer transformer)

  Description copied from interface: `LoadTimeWeaver`
  Add a `ClassFileTransformer` to be applied by this `LoadTimeWeaver`.

  Specified by:
    `addTransformer` in interface `LoadTimeWeaver`
  Parameters:
    `transformer` - the `ClassFileTransformer` to add

### getInstrumentableClassLoader

    public ClassLoader getInstrumentableClassLoader()

  Description copied from interface: `LoadTimeWeaver`
  Return a `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.

  Specified by:
    `getInstrumentableClassLoader` in interface `LoadTimeWeaver`
  Returns:
    the `ClassLoader` which will expose instrumented classes according to the registered transformers

### getThrowawayClassLoader

    public ClassLoader getThrowawayClassLoader()

  This implementation builds a `SimpleThrowawayClassLoader`.

  Specified by:
    `getThrowawayClassLoader` in interface `LoadTimeWeaver`
  Returns:
    a temporary throwaway `ClassLoader`; should return a new instance for each call, with no existing state

The Spring Framework

Copyright © 2002-2008 The Spring Framework.