|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.beans.DynamicBeanState
public class DynamicBeanState
A DynamicBeanState is used to package the state of a DynamicBean's properties and metadata in a serializable form, regardless of the serializability of the original DynamicBean.
When a DynamicBeanState's properties are changed, it keeps track of the changed properties and can subsequently apply only these changes to the original DynamicBean. It can also copy all of its properties into a fresh DynamicBean.
Note that a DynamicBeanState is itself a dynamic bean, and so it can be treated as a surrogate for the original source bean. This is handy, for example, when a client VM wishes to modify the properties of some dynamic bean on the server VM without actually deserializing or instantiating the server bean on the client side.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
Constructor Summary | |
---|---|
DynamicBeanState(java.lang.Object pBean)
Construct a DynamicBeanState initialized from the given "source bean". |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Register a listener for the PropertyChange event. |
void |
applyChanges(java.lang.Object pBean)
Saves all changed properties of this DynamicBeanState into a DynamicBean. |
void |
applyState(java.lang.Object pBean)
Saves all properties (not only the changed ones) of this DynamicBeanState into a DynamicBean. |
void |
clearDeltas()
Clears the record of which properties were changed since this state was last initialized. |
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Fire a PropertyChange event to all registered listeners. |
DynamicBeanInfo |
getBeanInfo()
Returns the DynamicBeanInfo for this state's source bean, resolving the bean info first, if necessary. |
java.util.Vector |
getModifiedProperties()
|
DynamicPropertyDescriptor |
getPropertyDescriptor(java.lang.String pName)
Returns the DynamicPropertyDescriptor for the specified property. |
java.lang.String[] |
getPropertyNames()
Returns the list of known property names. |
java.lang.Object |
getPropertyValue(java.lang.String pName)
Retrieves a property value of this state. |
void |
initializeFrom(java.lang.Object pBean)
Initialize this DynamicBeanState from the given "source bean". |
boolean |
isModified()
Has this bean been modified? |
protected boolean |
isSerializableClass(java.lang.Class cl)
Determine if a property value should be serialized as-is. |
protected boolean |
readValue(java.util.Hashtable pProperties,
java.lang.String pName,
java.lang.Object pValue)
When unserializing a value you may need to revert it to its original type. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a listener for the PropertyChange event. |
protected java.lang.Object |
replaceBeanInfo(DynamicBeanInfo pInfo)
When serializing a DynamicBeanInfo, it may need to be replaced with some portable representation. |
protected DynamicBeanInfo |
resolveBeanInfo(java.lang.Object pValue)
When deserializing a DynamicBeanInfo, the read object may need to be resolved from some portable representation. |
void |
setBeanInfo(DynamicBeanInfo info)
|
void |
setPropertyValue(java.lang.String pName,
java.lang.Object pValue)
Changes a property value of this state, recording it as a changed property. |
protected boolean |
writeValue(java.util.Hashtable pProperties,
java.lang.String pName,
java.lang.Object pValue)
When serializing a value you may need to convert it to a serializable type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public DynamicBeanState(java.lang.Object pBean) throws java.beans.IntrospectionException
pBean
- the source bean from which the DynamicBeanState
should be initialized.
java.beans.IntrospectionException
Method Detail |
---|
public void initializeFrom(java.lang.Object pBean) throws java.beans.IntrospectionException
pBean
- the source bean from which this state
should be initialized.
java.beans.IntrospectionException
public DynamicBeanInfo getBeanInfo()
public void setBeanInfo(DynamicBeanInfo info)
public DynamicPropertyDescriptor getPropertyDescriptor(java.lang.String pName)
pName
- the name of the property
public java.lang.String[] getPropertyNames()
public void clearDeltas()
public boolean isModified()
public java.util.Vector getModifiedProperties()
public java.lang.Object getPropertyValue(java.lang.String pName)
pName
- the name of the property whose value is to be retrieved
public void setPropertyValue(java.lang.String pName, java.lang.Object pValue)
pName
- the name of the property to be changedpValue
- the new value of the propertypublic void applyChanges(java.lang.Object pBean) throws PropertyNotFoundException
pBean
- the bean to which the changes are to be applied
PropertyNotFoundException
- if one of the changed
properties cannot be applied.public void applyState(java.lang.Object pBean) throws PropertyNotFoundException
pBean
- the bean to which the changes are to be applied
PropertyNotFoundException
- if one of the changed
properties cannot be applied.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- An object to be invoked when a PropertyChange
event is fired.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChange listener to be removed.protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
protected boolean isSerializableClass(java.lang.Class cl)
protected java.lang.Object replaceBeanInfo(DynamicBeanInfo pInfo)
protected DynamicBeanInfo resolveBeanInfo(java.lang.Object pValue)
protected boolean writeValue(java.util.Hashtable pProperties, java.lang.String pName, java.lang.Object pValue)
protected boolean readValue(java.util.Hashtable pProperties, java.lang.String pName, java.lang.Object pValue)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |