public class BackedDynamicRegistryBeanHandler extends java.lang.Object implements BackedBeanInfo, java.lang.reflect.InvocationHandler
InvocationHandler
implementation backed with
RegistryObject
proxies implementing the BackedBeanInfo
interface.Constructor and Description |
---|
BackedDynamicRegistryBeanHandler(PersistenceContext context,
DynamicRegistryBean bean,
BackedBeanMapper<DynamicRegistryBean> beanMapper)
Constructor for creating the
BackedDynamicRegistryBeanHandler instance. |
Modifier and Type | Method and Description |
---|---|
DynamicRegistryBean |
getBean()
Returns the registry bean.
|
Key |
getKey()
Returns the objects key.
|
java.util.Set<RegistryObject> |
getModifiedObjects()
Retrieves all modified
RegistryObject including the primary backed object. |
PersistenceContext |
getPersistenceContext()
Returns the pool, which created this bean.
|
java.util.Set<PropertyMapper> |
getPropertiesToMap()
Retrieves the
PropertyMapper instances that need to be invoked by
the BeanMapper working on this proxy. |
RegistryObject |
getRegistryObject()
Retrieves the backed
RegistryObject . |
java.lang.Object |
invoke(java.lang.Object pProxy,
java.lang.reflect.Method pMethod,
java.lang.Object[] pArgs)
Handle the bean methods:
- getters: ensure the bean is populated from the RO
- setters: ensure the RO is populated from the bean
- non-getter/setter: simply pass through to bean
- "system" methods : simply pass through to this object
|
boolean |
isCreated()
Returns, whether this is object has already been created in the registry.
|
boolean |
isDeleted()
Returns, whether the object is marked as deleted.
|
boolean |
isModified()
Returns, whether the object is modified.
|
void |
setBean(DynamicRegistryBean bean)
Sets the registry bean.
|
void |
setCreated(boolean created)
Sets, whether the object is created or retrieved from the registry.
|
void |
setDeleted(boolean deleted)
Sets, whether the object is marked as deleted.
|
void |
setModified(boolean modified)
Sets, whether the object is modified.
|
void |
setRegistryObject(RegistryObject ro)
Sets the backed
RegistryObject . |
void |
toBean()
Forces all property values to be loaded from the underlying registry
object.
|
void |
toJaxr()
Forces all property values to be updated into the underlying registry
object.
|
public BackedDynamicRegistryBeanHandler(PersistenceContext context, DynamicRegistryBean bean, BackedBeanMapper<DynamicRegistryBean> beanMapper)
BackedDynamicRegistryBeanHandler
instance.context
- The PersistenceContext
instancebean
- The DynamicRegistryBean
instancebeanMapper
- The BackedBeanMapper
having DynamicRegistryBean
instancespublic java.lang.Object invoke(java.lang.Object pProxy, java.lang.reflect.Method pMethod, java.lang.Object[] pArgs) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
public RegistryObject getRegistryObject()
RegistryObject
.getRegistryObject
in interface BackedBeanInfo
RegistryObject
instancepublic void setRegistryObject(RegistryObject ro)
BackedBeanInfo
RegistryObject
.setRegistryObject
in interface BackedBeanInfo
ro
- The RegistryObject
to setpublic void toBean() throws MappingException, JAXRException
BackedBeanInfo
toBean
in interface BackedBeanInfo
MappingException
- If an error occurs while enforcing the conditionJAXRException
- If a JAXR error occurs while trying to load from the registry objectspublic void toJaxr() throws MappingException, JAXRException
BackedBeanInfo
toJaxr
in interface BackedBeanInfo
MappingException
- If an error occurs while enforcing the conditionJAXRException
- If a JAXR error occurs while trying to update to the registry objectspublic java.util.Set<RegistryObject> getModifiedObjects()
RegistryObject
including the primary backed object.getModifiedObjects
in interface BackedBeanInfo
Set
of modified RegistryObject
spublic java.util.Set<PropertyMapper> getPropertiesToMap()
BackedBeanInfo
PropertyMapper
instances that need to be invoked by
the BeanMapper
working on this proxy. This is a workaround for
handing modifications on collection properties. It is expected that the
implementation for this method will return the property mappers for all
collection properties that have been retrieved and possibly modified.getPropertiesToMap
in interface BackedBeanInfo
Set
of PropertyMapper
s to mappublic boolean isModified()
BeanInfo
isModified
in interface BeanInfo
true
if the object is modified and false
otherwisepublic DynamicRegistryBean getBean()
BeanInfo
getBean
in interface BeanInfo
DynamicRegistryBean
instancepublic PersistenceContext getPersistenceContext()
BeanInfo
getPersistenceContext
in interface BeanInfo
PersistenceContext
instancepublic boolean isCreated()
BeanInfo
public boolean isDeleted()
BeanInfo
public void setBean(DynamicRegistryBean bean)
BeanInfo
setBean
in interface BeanInfo
bean
- the DynamicRegistryBean
instance to setpublic void setDeleted(boolean deleted)
BeanInfo
setDeleted
in interface BeanInfo
deleted
- If true
the object will be marked as deletedpublic void setModified(boolean modified)
BeanInfo
setModified
in interface BeanInfo
modified
- If true
the object will be set to modifiedpublic void setCreated(boolean created)
BeanInfo
setCreated
in interface BeanInfo
created
- If true
, the object is created in the registry and if false
,
the object has been retrieved from the registry and is already available