org.sourceforge.jemm.weaver.transformation
Class ConstructorProxyTransformation

java.lang.Object
  extended by org.sourceforge.jemm.weaver.transformation.AbstractClassTransformation
      extended by org.sourceforge.jemm.weaver.transformation.ConstructorProxyTransformation
All Implemented Interfaces:
Transformation

public class ConstructorProxyTransformation
extends AbstractClassTransformation

Proxies the constructors creation with a begin and end call. Produces code similar to: super(); try { ConstructorLifecycle.preConstructor(???.class.getName()); super(); ConstructorLifecycle.beginConstructor(this); //original code ConstructorLifecycle.endConstructor(this); } catch(Throwable t) { ConstructorLifecycle.failedConstructor(this); throw t; }

Author:
Paul Keeble

Constructor Summary
ConstructorProxyTransformation()
          Creates a ConstructorProxyTransformation instance.
 
Method Summary
 java.lang.String[] dependentTransforms()
          Depends on ShadowConstructorTransformation (and on ShadowTransformation) and on InterfaceTransformation.
 boolean isTransformableConstructor(javassist.CtConstructor c)
           
 void transform(javassist.CtClass clazz)
          Modifies the passed in CtClass based on the transformation necessary.
 void transformConstructor(javassist.CtClass clazz, javassist.CtConstructor c)
           
 
Methods inherited from class org.sourceforge.jemm.weaver.transformation.AbstractClassTransformation
equals, getTransformationName, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstructorProxyTransformation

public ConstructorProxyTransformation()
                               throws javassist.NotFoundException
Creates a ConstructorProxyTransformation instance.

Throws:
javassist.NotFoundException - Likely caused by a classpath issue
Method Detail

transform

public void transform(javassist.CtClass clazz)
               throws TransformationException
Description copied from interface: Transformation
Modifies the passed in CtClass based on the transformation necessary.

Specified by:
transform in interface Transformation
Specified by:
transform in class AbstractClassTransformation
Parameters:
clazz - The CtClass to modify
Throws:
TransformationException - If an error occurs in the transformation process

transformConstructor

public void transformConstructor(javassist.CtClass clazz,
                                 javassist.CtConstructor c)
                          throws javassist.CannotCompileException
Throws:
javassist.CannotCompileException

isTransformableConstructor

public boolean isTransformableConstructor(javassist.CtConstructor c)

dependentTransforms

public java.lang.String[] dependentTransforms()
Depends on ShadowConstructorTransformation (and on ShadowTransformation) and on InterfaceTransformation.

Specified by:
dependentTransforms in interface Transformation
Specified by:
dependentTransforms in class AbstractClassTransformation
Returns:
A list of transforms that must run first.


Copyright © 2009. All Rights Reserved.