Package org.datanucleus.enhancer
Class ImplementationCreatorImpl
java.lang.Object
org.datanucleus.enhancer.ImplementationCreatorImpl
- All Implemented Interfaces:
Serializable
,ImplementationCreator
public class ImplementationCreatorImpl
extends Object
implements Serializable, ImplementationCreator
Creator of persistable objects using the ASM bytecode manipulation library.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EnhancerClassLoader
ClassLoader for newly defined classesprotected final MetaDataManager
MetaData manager to use.private static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAccessor for the ClassLoader.protected ImplementationGenerator
getGenerator
(AbstractClassMetaData acmd, String implClassName) Method to return the generator for the implementation.newInstance
(Class cls, ClassLoaderResolver clr) Method to generate an instance of an interface, abstract class, or concrete PC class.protected Persistable
newInstance
(ClassMetaData cmd, ClassLoaderResolver clr) Constructs an implementation for an abstract class and instantiates it.protected Persistable
newInstance
(InterfaceMetaData imd, ClassLoaderResolver clr) Constructs an implementation for an interface and instantiates it.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
metaDataMgr
MetaData manager to use. -
loader
ClassLoader for newly defined classes
-
-
Constructor Details
-
ImplementationCreatorImpl
Constructor.- Parameters:
mmgr
- MetaData manager
-
-
Method Details
-
getClassLoader
Accessor for the ClassLoader.- Specified by:
getClassLoader
in interfaceImplementationCreator
- Returns:
- The ClassLoader
-
newInstance
Method to generate an instance of an interface, abstract class, or concrete PC class.- Specified by:
newInstance
in interfaceImplementationCreator
- Parameters:
cls
- The class of the interface, abstract class, or concrete class defined in MetaDataclr
- ClassLoader resolver- Returns:
- The instance of this type
-
newInstance
protected Persistable newInstance(InterfaceMetaData imd, ClassLoaderResolver clr) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException Constructs an implementation for an interface and instantiates it.- Parameters:
imd
- The MetaData for the interfaceclr
- The ClassLoader- Returns:
- The instance implementing the interface
- Throws:
ClassNotFoundException
- If an error occursInstantiationException
- If an error occursIllegalAccessException
- If an error occursInvocationTargetException
- If an error occursNoSuchMethodException
- If an error occurs
-
newInstance
protected Persistable newInstance(ClassMetaData cmd, ClassLoaderResolver clr) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException Constructs an implementation for an abstract class and instantiates it.- Parameters:
cmd
- The MetaData for the abstract classclr
- The ClassLoader- Returns:
- The instance implementing the abstract class.
- Throws:
ClassNotFoundException
- if an error occursInstantiationException
- if an error occursIllegalAccessException
- if an error occursInvocationTargetException
- If an error occursNoSuchMethodException
- If an error occurs
-
getGenerator
Method to return the generator for the implementation.- Parameters:
acmd
- MetaData for the interface or abstract classimplClassName
- Name of the implementation class to create- Returns:
- The implementation generator
-