uka.patch
Interface Patchable

All Superinterfaces:
java.lang.Cloneable, ReferenceProducer, java.io.Serializable

public interface Patchable
extends ReferenceProducer, java.io.Serializable, java.lang.Cloneable

The Patchable interface describes an object that can be monitored for changes using a PatchAdapter.


Method Summary
 void applyPatch(java.lang.Object copy, PatchInput s)
          Reads a patch from the passed PatchInput object and applies it to this object.
 void createPatch(java.lang.Object copy, PatchOutput s)
          Compares the state of this object with the passed backup copy of its own.
 java.lang.Object flatClone()
           
 
Methods inherited from interface uka.patch.ReferenceProducer
descendReferences, filterReferences
 

Method Detail

createPatch

public void createPatch(java.lang.Object copy,
                        PatchOutput s)
                 throws java.io.IOException

Compares the state of this object with the passed backup copy of its own. This is done by announcing each pair of corresponding instance variables of this and the backup copy to the passed PatchOutput object. If a difference is detected, the backup copy is updated to the state of this object.

This method is called by PatchAdapter.createPatch(MarshalStream).

Parameters:
copy - the backup copy of this object.
s - the patch output object that is used to compare the state.
Throws:
java.io.IOException

applyPatch

public void applyPatch(java.lang.Object copy,
                       PatchInput s)
                throws java.io.IOException,
                       java.lang.ClassNotFoundException

Reads a patch from the passed PatchInput object and applies it to this object. This is done by querying the PatchInput.hasDiff() method for each instance variable of this object. If PatchInput.hasDiff() returns true, then the new value is read with a method corresponding to the type of the instance variable (see PatchInput.getDiffAsInt()). The read value is assigned to the instance variable of this object and the corresponding instance variable of the backup copy.

This method is called by PatchAdapter.applyPatch(PatchReader).

Throws:
java.io.IOException
java.lang.ClassNotFoundException

flatClone

public java.lang.Object flatClone()