org.sourceforge.jemm.weaver.transformation
Interface Transformation

All Known Implementing Classes:
AbstractClassTransformation, AbstractShadowConstructorTransformation, AssignedShadowConstructorTransformation, ChildTransformations, CommonTransformations, ConstructorProxyTransformation, InterfaceTransformation, MethodAnnotationTransformation, MethodProxyTransformation, ParentTransformations, ShadowTransformation, SuperCallConstructorTransformation, SynchronizedBlockTransformation, TransformationChain

public interface Transformation

A ClassTransformation uses JavaAssist to update the class byte code. All ClassTransformation classes must implement equals and hashcode as they are stored in collections. The equality checks must make sure that transformations to do the same thing will result in the equality check returning true.

Author:
Paul Keeble

Method Summary
 java.lang.String[] dependentTransforms()
          Should return a list of the transformations that this transform requires before it can execute on a class.
 boolean equals(java.lang.Object obj)
          Note that the equals check is not just about equality, but whether the transforms are equivalent.
 java.lang.String getTransformationName()
          When the dependencies for a Transformation are being determined it is this name which should be listed in the dependency list.
 int hashCode()
           
 void transform(javassist.CtClass clazz)
          Modifies the passed in CtClass based on the transformation necessary.
 

Method Detail

transform

void transform(javassist.CtClass clazz)
               throws TransformationException
Modifies the passed in CtClass based on the transformation necessary.

Parameters:
clazz - The CtClass to modify
Throws:
TransformationException - If an error occurs in the transformation process

dependentTransforms

java.lang.String[] dependentTransforms()
Should return a list of the transformations that this transform requires before it can execute on a class. For the core Transformations this is equal to getClass().getSimpleName().

Returns:
A list of transforms that must run first.

getTransformationName

java.lang.String getTransformationName()
When the dependencies for a Transformation are being determined it is this name which should be listed in the dependency list. The name can be anything but AbstractClassTransformation implements this as getClass().getSimpleName() which is used in many of the transformations.

Returns:
The name of the transformation used in dependency matching

equals

boolean equals(java.lang.Object obj)
Note that the equals check is not just about equality, but whether the transforms are equivalent. Any equivalent transforms, even if a different object should result in a true return.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to check for equality.
Returns:
True if equal, false otherwise
See Also:
For the definition of equals, Which implements a default equals and hashcode

hashCode

int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
The hashcode
See Also:
Object.hashCode()


Copyright © 2009. All Rights Reserved.