站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

SimpleInstrumentableClassLoader (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.instrument.classloading
Class SimpleInstrumentableClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.springframework.core.OverridingClassLoader
          extended by org.springframework.instrument.classloading.SimpleInstrumentableClassLoader

public class SimpleInstrumentableClassLoader
extends OverridingClassLoader

Simplistic implementation of an instrumentable ClassLoader. Usable in tests and standalone environments.

Since:
2.0
Author:
Rod Johnson, Costin Leau

Constructor Summary
SimpleInstrumentableClassLoader(ClassLoader parent)
          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 ClassLoader.
protected  byte[] transformIfNecessary(String name, byte[] bytes)
          Transformation hook to be implemented by subclasses.
 
Methods inherited from class org.springframework.core.OverridingClassLoader
excludeClass, excludePackage, isEligibleForOverriding, loadClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleInstrumentableClassLoader

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

Parameters:
parent - the ClassLoader to build an simple instrumentable ClassLoader for
Method Detail

addTransformer

public void addTransformer(ClassFileTransformer transformer)
Add a class file transformer to be applied by this ClassLoader.

Parameters:
transformer - the class file transformer to register

transformIfNecessary

protected byte[] transformIfNecessary(String name,
                                      byte[] bytes)
Description copied from class: OverridingClassLoader
Transformation hook to be implemented by subclasses.

The default implementation simply returns the given bytes as-is.

Overrides:
transformIfNecessary in class OverridingClassLoader
Parameters:
name - the fully-qualified name of the class being transformed
bytes - the raw bytes of the class
Returns:
the transformed bytes (never null; same as the input bytes if the transformation produced no changes)

The Spring Framework

Copyright © 2002-2007 The Spring Framework.