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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected EnhancerClassLoader
loader
ClassLoader for newly defined classesprotected MetaDataManager
metaDataMgr
MetaData 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 ClassLoader
getClassLoader()
Accessor for the ClassLoader.protected ImplementationGenerator
getGenerator(AbstractClassMetaData acmd, String implClassName)
Method to return the generator for the implementation.Object
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 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:
getClassLoader
in 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:
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
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
-
-