|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.enhancer.AbstractClassEnhancer
org.datanucleus.enhancer.bcel.BCELClassEnhancer
public class BCELClassEnhancer
Class enhancer using Apache BCEL (http://jakarta.apache.org/bcel).
| Nested Class Summary | |
|---|---|
class |
BCELClassEnhancer.SerialVersionUID
Compute the serialVersionUID |
| Field Summary | |
|---|---|
protected long |
addSerialVersionUID
serialVersionUID value |
org.apache.bcel.generic.ObjectType |
classType
class type of enhancing class |
org.apache.bcel.generic.ConstantPoolGen |
constantPoolGen
constant pool of enhancing class |
org.apache.bcel.generic.ClassGen |
newClass
enhancing class |
org.apache.bcel.classfile.JavaClass |
oldClass
Original class |
static org.apache.bcel.generic.ObjectType |
OT_BitSet
Object type of java.util.BitSet |
static org.apache.bcel.generic.ObjectType |
OT_ByteIdentity
|
static org.apache.bcel.generic.ObjectType |
OT_CharIdentity
|
static org.apache.bcel.generic.ObjectType |
OT_CLASS
Object type of java.lang.Class |
static org.apache.bcel.generic.ObjectType |
OT_Detachable
Object type of javax.jdo.spi.Detachable |
static org.apache.bcel.generic.Type |
OT_Flag
Field type of jdoFlag |
static org.apache.bcel.generic.ObjectType |
OT_IntIdentity
|
static org.apache.bcel.generic.ObjectType |
OT_JDOImplHelper
Object type of javax.jdo.spi.JDOImplHelper |
static org.apache.bcel.generic.ObjectType |
OT_LongIdentity
Object type of SingleFieldIdentity classes |
static org.apache.bcel.generic.Type |
OT_ObjectArray
Type of Object[] |
static org.apache.bcel.generic.ObjectType |
OT_ObjectIdentity
|
static org.apache.bcel.generic.ObjectType |
OT_ObjectIdFieldConsumer
Object type of javax.jdo.spi.PersistenceCapable.ObjectIdFieldConsumer |
static org.apache.bcel.generic.ObjectType |
OT_ObjectIdFieldSupplier
Object type of javax.jdo.spi.PersistenceCapable.ObjectIdFieldSupplier |
static org.apache.bcel.generic.ObjectType |
OT_PersistenceCapable
Object type of javax.jdo.spi.PersistenceCapable |
static org.apache.bcel.generic.ObjectType |
OT_PersistenceManager
Object type of javax.spi.PersistenceManager |
static org.apache.bcel.generic.ObjectType |
OT_ShortIdentity
|
static org.apache.bcel.generic.ObjectType |
OT_StateManager
Object type of javax.jdo.spi.StateManager |
static org.apache.bcel.generic.ObjectType |
OT_StringIdentity
|
| Fields inherited from class org.datanucleus.enhancer.AbstractClassEnhancer |
|---|
className, clr, cmd, fieldsToAdd, initialised, LOCALISER, methodsToAdd, update |
| Constructor Summary | |
|---|---|
BCELClassEnhancer(org.datanucleus.metadata.ClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr)
Constructor. |
|
BCELClassEnhancer(org.datanucleus.metadata.ClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr,
byte[] classBytes)
Constructor. |
|
| Method Summary | |
|---|---|
protected java.lang.String |
checkHasDefaultConstructor()
Check original class has default(no arg) constructor. |
protected void |
class_addInterface(java.lang.String interfaceName)
Method to add the "implements {interface}" to the class description. |
boolean |
enhance()
Method to enhance the classes |
protected void |
enhanceClass()
Method to enhance the class as a whole, providing the required interfaces and adding any setters/getters for its fields |
protected void |
enhanceFields()
Method to enhance the fields |
protected void |
enhanceGetter(BCELFieldPropertyMetaData fieldConfig)
This method adds to the generated class the jdoGet methods |
protected void |
enhanceMethods()
Method to enhance the methods of the class. |
protected void |
enhanceOriginalMethod(org.apache.bcel.classfile.Method m)
|
protected void |
enhanceOriginalMethods()
|
protected void |
enhancePropertyAccessor(org.apache.bcel.classfile.Method m)
Takes the original getXXX, setXXX method and takes the code and creates a jdoGetXXX, jdoSetXXX with the exact same code. |
protected void |
enhancePropertyGetter(org.apache.bcel.classfile.Method m)
Method to take the method and create a valid getXXX when the method is a getter for a persistent property. |
protected void |
enhancePropertySetter(org.apache.bcel.classfile.Method m)
Method to take the method and create a valid setXXX when the method is a setter for a persistent property. |
protected void |
enhanceSetter(BCELFieldPropertyMetaData fieldConfig)
This method adds to the generated class the jdoSet methods |
protected void |
enhanceStaticInitializers()
|
byte[] |
getBytes()
Access the class in byte array format |
static java.lang.String |
getClassNameForFileName(java.lang.String filename)
Convenience accessor for the class name that is stored in a particular class. |
protected void |
initialiseFieldsList()
Initialise the fields that we need to add to this class |
protected void |
initialiseMethodsList()
Initialise the methods that we need to add to this class |
protected void |
staticInitializerAppend(org.apache.bcel.generic.InstructionFactory factory,
org.apache.bcel.generic.InstructionList il)
|
boolean |
validate()
Check original class is already enhanced. |
| Methods inherited from class org.datanucleus.enhancer.AbstractClassEnhancer |
|---|
getClassLoaderResolver, getClassMetaData, getFieldsList, getMethodsList, initialise, isPersistenceCapable, requiresDetachable, save |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final org.apache.bcel.classfile.JavaClass oldClass
public final org.apache.bcel.generic.ClassGen newClass
public final org.apache.bcel.generic.ConstantPoolGen constantPoolGen
public final org.apache.bcel.generic.ObjectType classType
protected long addSerialVersionUID
public static final org.apache.bcel.generic.Type OT_Flag
public static final org.apache.bcel.generic.Type OT_ObjectArray
public static final org.apache.bcel.generic.ObjectType OT_LongIdentity
public static final org.apache.bcel.generic.ObjectType OT_StringIdentity
public static final org.apache.bcel.generic.ObjectType OT_ShortIdentity
public static final org.apache.bcel.generic.ObjectType OT_IntIdentity
public static final org.apache.bcel.generic.ObjectType OT_CharIdentity
public static final org.apache.bcel.generic.ObjectType OT_ByteIdentity
public static final org.apache.bcel.generic.ObjectType OT_ObjectIdentity
public static final org.apache.bcel.generic.ObjectType OT_PersistenceManager
public static final org.apache.bcel.generic.ObjectType OT_ObjectIdFieldConsumer
public static final org.apache.bcel.generic.ObjectType OT_ObjectIdFieldSupplier
public static final org.apache.bcel.generic.ObjectType OT_BitSet
public static final org.apache.bcel.generic.ObjectType OT_StateManager
public static final org.apache.bcel.generic.ObjectType OT_PersistenceCapable
public static final org.apache.bcel.generic.ObjectType OT_Detachable
public static final org.apache.bcel.generic.ObjectType OT_JDOImplHelper
public static final org.apache.bcel.generic.ObjectType OT_CLASS
| Constructor Detail |
|---|
public BCELClassEnhancer(org.datanucleus.metadata.ClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr,
byte[] classBytes)
cmd - MetaData for the class to be enhancedclr - ClassLoader resolverclassBytes - Bytes of the class (unenhanced)
public BCELClassEnhancer(org.datanucleus.metadata.ClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr)
cmd - MetaData for the class to be enhancedclr - ClassLoader resolver| Method Detail |
|---|
public static java.lang.String getClassNameForFileName(java.lang.String filename)
filename - Name of the file
protected void initialiseMethodsList()
initialiseMethodsList in class AbstractClassEnhancerprotected void initialiseFieldsList()
initialiseFieldsList in class AbstractClassEnhancerpublic boolean validate()
protected java.lang.String checkHasDefaultConstructor()
public boolean enhance()
protected void enhanceClass()
protected void class_addInterface(java.lang.String interfaceName)
interfaceName - Name of the interface to add.protected void enhanceFields()
protected void enhanceMethods()
protected void enhanceStaticInitializers()
protected void staticInitializerAppend(org.apache.bcel.generic.InstructionFactory factory,
org.apache.bcel.generic.InstructionList il)
protected void enhanceOriginalMethod(org.apache.bcel.classfile.Method m)
protected void enhancePropertyAccessor(org.apache.bcel.classfile.Method m)
public String getName()
{
return name;
}
The generated method is:
public String jdoGetName()
{
return name;
}
m - The methodprotected void enhanceOriginalMethods()
protected void enhancePropertySetter(org.apache.bcel.classfile.Method m)
m - The methodprotected void enhancePropertyGetter(org.apache.bcel.classfile.Method m)
m - The methodprotected void enhanceSetter(BCELFieldPropertyMetaData fieldConfig)
fieldConfig - protected void enhanceGetter(BCELFieldPropertyMetaData fieldConfig)
fieldConfig - public byte[] getBytes()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||