| java.lang.Object java.beans.PersistenceDelegate
All known Subclasses: java.beans.StaticFieldPersistenceDelegate, java.beans.ArrayPersistenceDelegate, java.beans.PrimitiveWrapperPersistenceDelegate, java.beans.SwingToolTipManagerPersistenceDelegate, java.beans.DefaultPersistenceDelegate, java.beans.AwtMenuShortcutPersistenceDelegate, java.beans.SwingBoxPersistenceDelegate, java.beans.FieldPersistenceDelegate, java.beans.NullPersistenceDelegate, java.beans.MethodPersistenceDelegate, java.beans.StringPersistenceDelegate, java.beans.ClassPersistenceDelegate,
PersistenceDelegate | abstract public class PersistenceDelegate (Code) | | PersistenceDelegate instances write received bean objects to
encoders in the form of expressions and statements, which can be evaluated or
executed to reconstruct the recorded bean objects in a new environment during
decoding. Expressions are usually used to instantiate bean objects in the new
environment, and statements are used to initialize their properties if
necessary. As a result, the reconstructed bean objects become equivalent to
the original recorded ones in terms of their public states.
|
Method Summary | |
protected void | initialize(Class> type, Object oldInstance, Object newInstance, Encoder enc) Produces a series of expressions and statements for the initialization of
a bean object's properties. | abstract protected Expression | instantiate(Object oldInstance, Encoder enc) Constructs an expression for instantiating an object of the same type as
the old instance. | protected boolean | mutatesTo(Object o1, Object o2) Determines whether one object mutates to the other object. | public void | writeObject(Object oldInstance, Encoder out) Writes a bean object to the given encoder. |
PersistenceDelegate | public PersistenceDelegate()(Code) | | Default constructor.
|
initialize | protected void initialize(Class> type, Object oldInstance, Object newInstance, Encoder enc)(Code) | | Produces a series of expressions and statements for the initialization of
a bean object's properties. The default implementation simply invokes the
initialization provided by the super class's
PersisteneceDelegate instance.
Parameters: type - the type of the bean Parameters: oldInstance - the original bean object to be recorded Parameters: newInstance - the simmulating new bean object to be initialized Parameters: enc - the encoder to write the outputs to |
instantiate | abstract protected Expression instantiate(Object oldInstance, Encoder enc)(Code) | | Constructs an expression for instantiating an object of the same type as
the old instance. Any exceptions occured during this process could be
reported to the exception listener registered in the given encoder.
Parameters: oldInstance - the old instance Parameters: enc - the encoder that wants to record the old instance an expression for instantiating an object of the same type as theold instance |
mutatesTo | protected boolean mutatesTo(Object o1, Object o2)(Code) | | Determines whether one object mutates to the other object. One object is
considered able to mutate to another object if they are indistinguishable
in terms of behaviors of all public APIs. The default implementation here
is to return true only if the two objects are instances of the same
class.
Parameters: o1 - one object Parameters: o2 - the other object true if second object mutates to the first object, otherwisefalse |
writeObject | public void writeObject(Object oldInstance, Encoder out)(Code) | | Writes a bean object to the given encoder. First it is checked whether
the simulating new object can be mutated to the old instance. If yes, it
is initialized to produce a series of expressions and statements that can
be used to restore the old instance. Otherwise, remove the new object in
the simulating new environment and writes an expression that can
instantiate a new instance of the same type as the old one to the given
encoder.
Parameters: oldInstance - the old instance to be written Parameters: out - the encoder that the old instance will be written to |
|
|