public class DefaultPersistenceDelegate extends PersistenceDelegate
Encoder
Constructor and Description |
---|
DefaultPersistenceDelegate()
Constructs a
DefaultPersistenceDelegate instance that
supports the persistence of a bean which has a default constructor. |
DefaultPersistenceDelegate(java.lang.String[] propertyNames)
Constructs a
DefaultPersistenceDelegate instance that
supports the persistence of a bean which is constructed with some
properties. |
Modifier and Type | Method and Description |
---|---|
protected void |
initialize(java.lang.Class<?> type,
java.lang.Object oldInstance,
java.lang.Object newInstance,
Encoder enc)
Initializes the new instance in the new environment so that it becomes
equivalent with the old one, meanwhile recording this process in the
encoder.
|
protected Expression |
instantiate(java.lang.Object oldInstance,
Encoder enc)
Returns an expression that represents a call to the bean's constructor.
|
protected boolean |
mutatesTo(java.lang.Object o1,
java.lang.Object o2)
Determines whether one object mutates to the other object.
|
writeObject
public DefaultPersistenceDelegate()
DefaultPersistenceDelegate
instance that
supports the persistence of a bean which has a default constructor.public DefaultPersistenceDelegate(java.lang.String[] propertyNames)
DefaultPersistenceDelegate
instance that
supports the persistence of a bean which is constructed with some
properties.propertyNames
- the name of the properties that are taken as parameters by the
bean's constructorprotected void initialize(java.lang.Class<?> type, java.lang.Object oldInstance, java.lang.Object newInstance, Encoder enc)
initialize
in class PersistenceDelegate
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 Expression instantiate(java.lang.Object oldInstance, Encoder enc)
DefaultPersistenceDelegate
is constructed.instantiate
in class PersistenceDelegate
oldInstance
- the old instanceenc
- the encoder that wants to record the old instanceprotected boolean mutatesTo(java.lang.Object o1, java.lang.Object o2)
DefaultPersistenceDelegate
is constructed with one or more
property names, and the class of o1
overrides the
"equals(Object)" method, then o2
is considered to mutate
to o1
if o1
equals to o2
.
Otherwise, the result is the same as the definition in
PersistenceDelegate
.mutatesTo
in class PersistenceDelegate
o1
- one objecto2
- the other object