Class ImplementationGenerator
java.lang.Object
org.datanucleus.enhancer.ImplementationGenerator
Implementation generator using ASM bytecode manipulation library.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) StringASM class name of the implementation class.(package private) StringASM type descriptor for the implementation class.protected byte[]bytes for the implementation class.protected final StringClass name of the implementation.protected final StringFully-qualified class name (including package) of the implementation.protected StringClass name for the superclass.protected final AbstractClassMetaDataMeta data for the abstract-class/interfaceprotected final MetaDataManager(package private) EnhancementNamer(package private) ClassWriterWriter for the implementation class. -
Constructor Summary
ConstructorsConstructorDescriptionImplementationGenerator(ClassMetaData cmd, String implClassName, MetaDataManager mmgr) Constructor for an implementation of an abstract class.ImplementationGenerator(InterfaceMetaData interfaceMetaData, String implClassName, MetaDataManager mmgr) Constructor for an implementation of a persistent interface. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCreate a default constructor, assuming that there is no persistent superclass.protected voidCreate a getter method for a /property.protected voidCreates fields for the properties of this class and super classes.protected voidCreate the fields for the implementation.protected voidCreate getters and setters methods for this class and super classesprotected voidCreate getters and setters methods.protected voidCreate a setter method for a property.voiddumpToFile(String filename) Convenience method to dump the generated class to the specified file.voidEnhance the implementation of the class/interface.byte[]getBytes()Accessor for the byte representation of the generated class.
-
Field Details
-
metaDataMgr
-
inputCmd
Meta data for the abstract-class/interface -
className
Class name of the implementation. -
fullClassName
Fully-qualified class name (including package) of the implementation. -
fullSuperclassName
Class name for the superclass. -
bytes
protected byte[] bytesbytes for the implementation class. -
writer
ClassWriter writerWriter for the implementation class. -
asmClassName
String asmClassNameASM class name of the implementation class. -
asmTypeDescriptor
String asmTypeDescriptorASM type descriptor for the implementation class. -
namer
EnhancementNamer namer
-
-
Constructor Details
-
ImplementationGenerator
public ImplementationGenerator(InterfaceMetaData interfaceMetaData, String implClassName, MetaDataManager mmgr) Constructor for an implementation of a persistent interface.- Parameters:
interfaceMetaData- MetaData for the persistent interfaceimplClassName- Name of the implementation class to generate (omitting packages)mmgr- MetaData manager
-
ImplementationGenerator
Constructor for an implementation of an abstract class.- Parameters:
cmd- MetaData for the abstract classimplClassName- Name of the implementation class to generate (omitting packages)mmgr- MetaData manager
-
-
Method Details
-
getBytes
public byte[] getBytes()Accessor for the byte representation of the generated class.- Returns:
- the byte representation of the class
-
createPropertyFields
protected void createPropertyFields()Creates fields for the properties of this class and super classes. -
createPropertyMethods
protected void createPropertyMethods()Create getters and setters methods for this class and super classes -
createPropertyMethods
Create getters and setters methods.- Parameters:
acmd- AbstractClassMetaData
-
dumpToFile
Convenience method to dump the generated class to the specified file.- Parameters:
filename- Name of the file to dump to
-
enhance
Enhance the implementation of the class/interface.- Parameters:
clr- ClassLoader resolver
-
createPropertyFields
Create the fields for the implementation.- Parameters:
acmd- MetaData for the class/interface
-
createDefaultConstructor
protected void createDefaultConstructor()Create a default constructor, assuming that there is no persistent superclass. -
createGetter
Create a getter method for a /property.- Parameters:
mmd- MetaData for the property
-
createSetter
Create a setter method for a property.- Parameters:
mmd- MetaData for the property
-