org.springsource.loaded.agent
Class CglibPlugin

java.lang.Object
  extended by org.springsource.loaded.agent.CglibPlugin
All Implemented Interfaces:
LoadtimeInstrumentationPlugin, Plugin

public class CglibPlugin
extends java.lang.Object
implements LoadtimeInstrumentationPlugin

The CGLIB plugin recognizes when elements of cglib are loaded and rewrites them to catch certain events occuring.

Since:
0.8.3

Constructor Summary
CglibPlugin()
           
 
Method Summary
 boolean accept(java.lang.String slashedTypeName, java.lang.ClassLoader classLoader, java.security.ProtectionDomain protectionDomain, byte[] bytes)
          Called by the agent to determine if this plugin is interested in changing the specified type at load time.
 byte[] modify(java.lang.String slashedClassName, java.lang.ClassLoader classLoader, byte[] bytes)
          Once accept has returned true for a type, the modify method will be called to make the actual change to the classfile bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CglibPlugin

public CglibPlugin()
Method Detail

accept

public boolean accept(java.lang.String slashedTypeName,
                      java.lang.ClassLoader classLoader,
                      java.security.ProtectionDomain protectionDomain,
                      byte[] bytes)
Description copied from interface: LoadtimeInstrumentationPlugin
Called by the agent to determine if this plugin is interested in changing the specified type at load time. This is used when the plugin wishes to do some kind of transformation itself before the type is loaded - for example modify it to record something that will later be used on a reload event.

Specified by:
accept in interface LoadtimeInstrumentationPlugin
Parameters:
slashedTypeName - the type name, slashed form (e.g. java/lang/String)
classLoader - the classloader loading the type
bytes - the classfile contents for the type
Returns:
true if this plugin wants to change the bytes for the named type

modify

public byte[] modify(java.lang.String slashedClassName,
                     java.lang.ClassLoader classLoader,
                     byte[] bytes)
Description copied from interface: LoadtimeInstrumentationPlugin
Once accept has returned true for a type, the modify method will be called to make the actual change to the classfile bytes.

Specified by:
modify in interface LoadtimeInstrumentationPlugin
classLoader - the classloader loading the type
bytes - the classfile contents for the type
Returns:
the new (modified) bytes for the class