Package org.datanucleus.enhancer
Class ImplementationGenerator
java.lang.Object
org.datanucleus.enhancer.ImplementationGenerator
Implementation generator using ASM bytecode manipulation library.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String
ASM class name of the implementation class.(package private) String
ASM type descriptor for the implementation class.protected byte[]
bytes for the implementation class.protected final String
Class name of the implementation.protected final String
Fully-qualified class name (including package) of the implementation.protected String
Class name for the superclass.protected final AbstractClassMetaData
Meta data for the abstract-class/interfaceprotected final MetaDataManager
(package private) EnhancementNamer
(package private) ClassWriter
Writer 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 void
Create a default constructor, assuming that there is no persistent superclass.protected void
Create a getter method for a /property.protected void
Creates fields for the properties of this class and super classes.protected void
Create the fields for the implementation.protected void
Create getters and setters methods for this class and super classesprotected void
Create getters and setters methods.protected void
Create a setter method for a property.void
dumpToFile
(String filename) Convenience method to dump the generated class to the specified file.void
Enhance 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
-