org.apache.beehive.controls.runtime.bean
Class BeanPersistenceDelegate

Object
  extended by PersistenceDelegate
      extended by DefaultPersistenceDelegate
          extended by BeanPersistenceDelegate

public class BeanPersistenceDelegate
extends DefaultPersistenceDelegate

The BeanPersistenceDelegate class supports the XML persistence of Control JavaBeans by implementing the java.beans.PersistenceDelegate API, and overriding the default persistence algorithm based upon the runtime structure for Controls. It selectively registers other PersistenceDelegate instances for other nested entities, as required, to ensure that runtime-defined state and object relationships are properly maintained.

For the BeanInfo of all generated ControlJavaBeans, a BeanPersistenceDelegate instance will be registered as the "persistenceDelegate" attribute in the BeanDescriptor. The standard java.beans.Encoder persistence delegate lookup mechanism recognizes this attribute and will use the instance to persist an ControlBeans written to the encoding stream.

The BeanPersistence class implements optimized property persistence based upon the fact that the ControlBean already has a map containing all non-default property state. Rather than using the standard (and slower) algorithm of comparing the encoding instance against a 'clean' instance, the delegate can simply retrieve the map and persist the values contained within it.

See Also:
XMLEncoder, PersistenceDelegate

Constructor Summary
BeanPersistenceDelegate()
           
 
Method Summary
protected  void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out)
          PersistenceDelegate.initialize()
protected  Expression instantiate(Object oldInstance, Encoder out)
          PersistenceDelegate.instantiate()
 void writeObject(Object oldInstance, Encoder out)
          PersistenceDelegate.writeObject()
 
Methods inherited from class DefaultPersistenceDelegate
mutatesTo
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPersistenceDelegate

public BeanPersistenceDelegate()
Method Detail

instantiate

protected Expression instantiate(Object oldInstance,
                                 Encoder out)
PersistenceDelegate.instantiate()

Overrides:
instantiate in class DefaultPersistenceDelegate

initialize

protected void initialize(Class<?> type,
                          Object oldInstance,
                          Object newInstance,
                          Encoder out)
PersistenceDelegate.initialize()

Overrides:
initialize in class DefaultPersistenceDelegate

writeObject

public void writeObject(Object oldInstance,
                        Encoder out)
PersistenceDelegate.writeObject()

Overrides:
writeObject in class PersistenceDelegate