- 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected EnhancerClassLoaderloaderClassLoader for newly defined classesprotected MetaDataManagermetaDataMgrMetaData manager to use.
-
Constructor Summary
Constructors Constructor Description ImplementationCreatorImpl(MetaDataManager mmgr)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassLoadergetClassLoader()Accessor for the ClassLoader.protected ImplementationGeneratorgetGenerator(AbstractClassMetaData acmd, String implClassName)Method to return the generator for the implementation.ObjectnewInstance(Class cls, ClassLoaderResolver clr)Method to generate an instance of an interface, abstract class, or concrete PC class.protected PersistablenewInstance(ClassMetaData cmd, ClassLoaderResolver clr)Constructs an implementation for an abstract class and instantiates it.protected PersistablenewInstance(InterfaceMetaData imd, ClassLoaderResolver clr)Constructs an implementation for an interface and instantiates it.
-
-
-
Field Detail
-
metaDataMgr
protected final MetaDataManager metaDataMgr
MetaData manager to use.
-
loader
protected final EnhancerClassLoader loader
ClassLoader for newly defined classes
-
-
Constructor Detail
-
ImplementationCreatorImpl
public ImplementationCreatorImpl(MetaDataManager mmgr)
Constructor.- Parameters:
mmgr- MetaData manager
-
-
Method Detail
-
getClassLoader
public ClassLoader getClassLoader()
Accessor for the ClassLoader.- Specified by:
getClassLoaderin interfaceImplementationCreator- Returns:
- The ClassLoader
-
newInstance
public Object newInstance(Class cls, ClassLoaderResolver clr)
Method to generate an instance of an interface, abstract class, or concrete PC class.- Specified by:
newInstancein 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
protected ImplementationGenerator getGenerator(AbstractClassMetaData acmd, String implClassName)
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
-
-