|
|||||||||
Home >> All >> edu >> ucsb >> ccs >> jbcd >> [ transformation overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
edu.ucsb.ccs.jbcd.transformation
Class ClassTransformer

java.lang.Objectedu.ucsb.ccs.jbcd.transformation.ClassTransformer
- public class ClassTransformer
- extends java.lang.Object
A ClassTransformer executes a complex transformation on a JavaClass object. The complex transform is made up of simpler transforms that are carried out in sequence on the class itself and on each method.
Transformations are stored as a list, and are executed in the
order that they appear. The list may be modified with
insert(Transformation)
and
append(Transformation)
. Use the
transform(JavaClass)
method to apply the
transformations to a class.
- Version:
- $Id: ClassTransformer.java,v 1.2 2003/01/04 08:35:15 parkera Exp $
Field Summary | |
protected org.apache.bcel.generic.ConstantPoolGen |
constantPoolGen
A ConstantPoolGen for currentClass . |
protected org.apache.bcel.classfile.JavaClass |
currentClass
The class currently being transformed. |
protected org.apache.bcel.generic.InstructionFactory |
instructionFactory
An instruction factory to use when creating bytecode into a class. |
protected MethodSet |
methodSet
A set of methods that will be in the current class after transformation. |
protected java.util.Hashtable |
sharedInfo
A hashtable of data that is shared between transformations. |
protected java.util.LinkedList |
transforms
List to store transforms. |
Constructor Summary | |
ClassTransformer()
Create an empty ClassTransformer. |
Method Summary | |
protected boolean |
_Invariant()
|
protected boolean |
append_Postcondition(Transformation t,
java.lang.Void RESULT)
|
protected boolean |
append_Precondition(Transformation t)
|
void |
append(Transformation t)
Add a Transformation at the end of the transformation list. |
org.apache.bcel.generic.ConstantPoolGen |
getConstantPoolGen()
Get the ConstantPoolGen object that is to be used to build the constant pool for the current class. |
org.apache.bcel.classfile.JavaClass |
getCurrentClass()
Get the class that the transformer is transforming. |
protected boolean |
getInstructionFactory_Postcondition(org.apache.bcel.generic.InstructionFactory RESULT)
|
org.apache.bcel.generic.InstructionFactory |
getInstructionFactory()
Get the instruction factory that should be used to create instructions. |
MethodSet |
getMethodSet()
Get the method set that holds working copies of the methods in the current class. |
java.util.Hashtable |
getSharedInfo()
Get the shared data table. |
protected boolean |
insert_Postcondition(Transformation t,
java.lang.Void RESULT)
|
protected boolean |
insert_Precondition(Transformation t)
|
void |
insert(Transformation t)
Insert a transformation at the beginning of the list. |
protected boolean |
setInstructionFactory_Postcondition(org.apache.bcel.generic.InstructionFactory factory)
|
protected boolean |
setInstructionFactory_Precondition(org.apache.bcel.generic.InstructionFactory factory)
|
void |
setInstructionFactory(org.apache.bcel.generic.InstructionFactory factory)
Set the instruction factory to be used to create bytecode for the current class. |
protected boolean |
size_Postcondition(int RESULT)
|
int |
size()
Get the number of transformations in the transformer. |
protected boolean |
transform_Precondition(org.apache.bcel.classfile.JavaClass javaclass)
|
void |
transform(org.apache.bcel.classfile.JavaClass javaclass)
Transform a class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
currentClass
protected org.apache.bcel.classfile.JavaClass currentClass
- The class currently being transformed.
constantPoolGen
protected org.apache.bcel.generic.ConstantPoolGen constantPoolGen
- A ConstantPoolGen for
currentClass
.
methodSet
protected MethodSet methodSet
- A set of methods that will be in the current class after
transformation. Note that the result of
currentClass.getMethods()
will not neccessarily match this set because Transformations may add and remove methods from the set.
sharedInfo
protected java.util.Hashtable sharedInfo
- A hashtable of data that is shared between transformations. A
transformation that has data needed by other transformations may
store it in this table, under some published key.
transforms
protected java.util.LinkedList transforms
- List to store transforms. The transforms are applied to a class
in the order that they appear in this list.
instructionFactory
protected org.apache.bcel.generic.InstructionFactory instructionFactory
- An instruction factory to use when creating bytecode into a
class. The `transform(JavaClass)' method sets the constant pool
used by this factory to the correct constant pool for the current
class. The default factory can be overridden with
setInstructionFactory(InstructionFactory)
.
Constructor Detail |
ClassTransformer
public ClassTransformer()
- Create an empty ClassTransformer.
Method Detail |
transform
public void transform(org.apache.bcel.classfile.JavaClass javaclass) throws AbortTransformationException
- Transform a class. Each Transform in `transforms' will be
offered the opportunity to operate on the class. The transforms
will be applied in the order in which they appear in the
`transforms' list.
transform_Precondition
protected boolean transform_Precondition(org.apache.bcel.classfile.JavaClass javaclass)
insert
public void insert(Transformation t)
- Insert a transformation at the beginning of the list.
insert_Precondition
protected boolean insert_Precondition(Transformation t)
insert_Postcondition
protected boolean insert_Postcondition(Transformation t, java.lang.Void RESULT)
append
public void append(Transformation t)
- Add a Transformation at the end of the transformation list.
append_Precondition
protected boolean append_Precondition(Transformation t)
append_Postcondition
protected boolean append_Postcondition(Transformation t, java.lang.Void RESULT)
size
public int size()
- Get the number of transformations in the transformer.
size_Postcondition
protected boolean size_Postcondition(int RESULT)
getCurrentClass
public org.apache.bcel.classfile.JavaClass getCurrentClass()
- Get the class that the transformer is transforming. The current
class is only meaningful when executing the
transform
method, so only Transformation objects should call this method.
getConstantPoolGen
public org.apache.bcel.generic.ConstantPoolGen getConstantPoolGen()
- Get the ConstantPoolGen object that is to be used to build the
constant pool for the current class. This is only meaningful
when executing the
transform
method (when there is a current class), so only Transformation objects should call this method.
getMethodSet
public MethodSet getMethodSet()
- Get the method set that holds working copies of the methods in
the current class. This set is only meaningful when executing
the
transform
method, so only Transformation objects should call this method.
getSharedInfo
public java.util.Hashtable getSharedInfo()
- Get the shared data table. This table is provided so that
Transformations can communicate with each other in a crude way.
If one transformation has a piece of data needed by a subsequent
transformation, it may store it in this table, indexed by a
published key. This table is cleared between calls to
transform
.
getInstructionFactory
public org.apache.bcel.generic.InstructionFactory getInstructionFactory()
- Get the instruction factory that should be used to create
instructions. This factory has been initialized with the correct
constant pool for the current class.
getInstructionFactory_Postcondition
protected boolean getInstructionFactory_Postcondition(org.apache.bcel.generic.InstructionFactory RESULT)
setInstructionFactory
public void setInstructionFactory(org.apache.bcel.generic.InstructionFactory factory)
- Set the instruction factory to be used to create bytecode for the
current class. The constant pool in this factory will be set by
the
transform(JavaClass)
method, so it is not neccessary to reset the factory after every class is transformed.
setInstructionFactory_Precondition
protected boolean setInstructionFactory_Precondition(org.apache.bcel.generic.InstructionFactory factory)
setInstructionFactory_Postcondition
protected boolean setInstructionFactory_Postcondition(org.apache.bcel.generic.InstructionFactory factory)
_Invariant
protected boolean _Invariant()
|
|||||||||
Home >> All >> edu >> ucsb >> ccs >> jbcd >> [ transformation overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |