T
- Type class extending RegistryBean
public class BaseObjectFactory<T extends RegistryBean> extends java.lang.Object implements ObjectFactory<T>
ObjectFactory
interface. Uses
PersistenceContext
instance to work with the registry. Extending
classes should override the getActualBeanClass(RegistryObject)
method.Constructor and Description |
---|
BaseObjectFactory() |
Modifier and Type | Method and Description |
---|---|
static <T extends RegistryBean> |
createInstance(PersistenceContext context,
java.lang.Class<T> beanClass)
Factory method for creating instances of this abstract class.
|
T |
createRegistryBean(RegistryObject registryObject)
Creates
RegistryBean instance from the given RegistryObject based on configuration. |
RegistryObject |
createRegistryObject(RegistryBean registryBean)
Creates
RegistryObject instance from the given RegistryBean based on configuration. |
java.lang.Class<T> |
getBaseBeanClass()
Returns the
Class that this factory works on. |
PersistenceContext |
getContext()
Returns the
PersistenceContext used by this instance. |
public static <T extends RegistryBean> BaseObjectFactory<T> createInstance(PersistenceContext context, java.lang.Class<T> beanClass)
T
- Type class extending RegistryBean
context
- The PersistenceContext
instance to be used by the
object factory.beanClass
- The bean type for which object factory will be created.BaseObjectFactory
instancepublic T createRegistryBean(RegistryObject registryObject) throws JAXRException, MappingException
RegistryBean
instance from the given RegistryObject
based on configuration.createRegistryBean
in interface ObjectFactory<T extends RegistryBean>
registryObject
- The JAXR RegistryObject
RegistryBean
object.JAXRException
- If a JAXR error occurs while accessing registryObjectMappingException
- If an error occurs while mapping the JAXR object to a bean objectpublic RegistryObject createRegistryObject(RegistryBean registryBean) throws MappingException, JAXRException
RegistryObject
instance from the given RegistryBean
based on configuration.createRegistryObject
in interface ObjectFactory<T extends RegistryBean>
registryBean
- The RegistryBean
objectRegistryObject
.MappingException
- If an error occurs while mapping the bean object to JAXRJAXRException
- If a JAXR error occurs while creating the registry objectpublic PersistenceContext getContext()
PersistenceContext
used by this instance.PersistenceContext
instancepublic java.lang.Class<T> getBaseBeanClass()
Class
that this factory works on.Class