com.threerings.delta
Class ReflectiveDelta

java.lang.Object
  extended by com.threerings.delta.Delta
      extended by com.threerings.delta.ReflectiveDelta
All Implemented Interfaces:
com.threerings.io.Streamable
Direct Known Subclasses:
ActorDelta

public class ReflectiveDelta
extends Delta

A delta object that uses reflection to compare and modify the objects' fields. Note that unchanged object fields will be preserved by reference.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
com.threerings.io.Streamable.Closure
 
Constructor Summary
ReflectiveDelta()
          No-arg constructor for deserialization.
ReflectiveDelta(Object original, Object revised)
          Creates a new reflective delta that transforms the original object into the revised object (both of which must be instances of the same class).
 
Method Summary
 Object apply(Object original)
          Applies this delta to the specified object.
 boolean isEmpty()
          Checks whether the delta is empty.
 Delta merge(Delta other)
          Merges this delta with another.
 void readObject(com.threerings.io.ObjectInputStream in)
          Custom read method.
 String toString()
           
 void writeObject(com.threerings.io.ObjectOutputStream out)
          Custom write method.
 
Methods inherited from class com.threerings.delta.Delta
checkDeltable, createDelta
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReflectiveDelta

public ReflectiveDelta(Object original,
                       Object revised)
Creates a new reflective delta that transforms the original object into the revised object (both of which must be instances of the same class).


ReflectiveDelta

public ReflectiveDelta()
No-arg constructor for deserialization.

Method Detail

isEmpty

public boolean isEmpty()
Checks whether the delta is empty.


writeObject

public void writeObject(com.threerings.io.ObjectOutputStream out)
                 throws IOException
Custom write method.

Throws:
IOException

readObject

public void readObject(com.threerings.io.ObjectInputStream in)
                throws IOException,
                       ClassNotFoundException
Custom read method.

Throws:
IOException
ClassNotFoundException

apply

public Object apply(Object original)
Description copied from class: Delta
Applies this delta to the specified object.

Specified by:
apply in class Delta
Returns:
a new object incorporating the changes represented by this delta.

merge

public Delta merge(Delta other)
Description copied from class: Delta
Merges this delta with another.

Specified by:
merge in class Delta
Returns:
a new delta containing the changes included in both.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.