public abstract class PersistenceDelegate
extends java.lang.Object
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.Constructor and Description |
---|
PersistenceDelegate()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
initialize(java.lang.Class<?> type,
java.lang.Object oldInstance,
java.lang.Object newInstance,
Encoder enc)
Produces a series of expressions and statements for the initialization of
a bean object's properties.
|
protected abstract Expression |
instantiate(java.lang.Object oldInstance,
Encoder enc)
Constructs an expression for instantiating an object of the same type as
the old instance.
|
protected boolean |
mutatesTo(java.lang.Object o1,
java.lang.Object o2)
Determines whether one object mutates to the other object.
|
void |
writeObject(java.lang.Object oldInstance,
Encoder out)
Writes a bean object to the given encoder.
|
protected void initialize(java.lang.Class<?> type, java.lang.Object oldInstance, java.lang.Object newInstance, Encoder enc)
PersisteneceDelegate
instance.type
- the type of the beanoldInstance
- the original bean object to be recordednewInstance
- the simmulating new bean object to be initializedenc
- the encoder to write the outputs toprotected abstract Expression instantiate(java.lang.Object oldInstance, Encoder enc)
oldInstance
- the old instanceenc
- the encoder that wants to record the old instanceprotected boolean mutatesTo(java.lang.Object o1, java.lang.Object o2)
o1
- one objecto2
- the other objectpublic void writeObject(java.lang.Object oldInstance, Encoder out)
oldInstance
- the old instance to be writtenout
- the encoder that the old instance will be written to