com.threerings.delta
Class ReflectiveDelta.FieldHandler

java.lang.Object
  extended by com.threerings.delta.ReflectiveDelta.FieldHandler
Direct Known Subclasses:
ReflectiveDelta.FinalFieldHandler
Enclosing class:
ReflectiveDelta

protected abstract static class ReflectiveDelta.FieldHandler
extends Object

Handles a particular field.


Constructor Summary
protected ReflectiveDelta.FieldHandler()
           
 
Method Summary
abstract  void apply(Field field, Object original, Object revised, ArrayMask mask, MutableInteger midx, Object[] values, MutableInteger vidx)
          Applies the delta value (if any) to the provided objects.
abstract  void populate(Field field, Object original, Object revised, ArrayMask mask, MutableInteger midx, List<Object> values)
          Compares the field in the original and revised objects and, if they differ, populates the supplied mask and values list with the delta values.
abstract  void read(ArrayMask mask, MutableInteger midx, List<Object> values, ObjectInputStream in)
          Reads the delta value for the field (if any) from the stream.
 void toString(Field field, ArrayMask mask, MutableInteger midx, Object[] values, MutableInteger vidx, StringBuilder buf)
          Writes the delta value (if any) to the specified string.
abstract  void write(ArrayMask mask, MutableInteger midx, Object[] values, MutableInteger vidx, ObjectOutputStream out)
          Writes the delta value for the field (if any) to the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectiveDelta.FieldHandler

protected ReflectiveDelta.FieldHandler()
Method Detail

populate

public abstract void populate(Field field,
                              Object original,
                              Object revised,
                              ArrayMask mask,
                              MutableInteger midx,
                              List<Object> values)
                       throws IllegalAccessException
Compares the field in the original and revised objects and, if they differ, populates the supplied mask and values list with the delta values.

Parameters:
midx - an in/out parameter representing the index in the mask.
Throws:
IllegalAccessException

write

public abstract void write(ArrayMask mask,
                           MutableInteger midx,
                           Object[] values,
                           MutableInteger vidx,
                           ObjectOutputStream out)
                    throws IOException
Writes the delta value for the field (if any) to the stream.

Parameters:
midx - an in/out parameter representing the index in the mask.
vidx - an in/out parameter representing the index in the value array.
Throws:
IOException

read

public abstract void read(ArrayMask mask,
                          MutableInteger midx,
                          List<Object> values,
                          ObjectInputStream in)
                   throws IOException,
                          ClassNotFoundException
Reads the delta value for the field (if any) from the stream.

Parameters:
midx - an in/out parameter representing the index in the mask.
Throws:
IOException
ClassNotFoundException

apply

public abstract void apply(Field field,
                           Object original,
                           Object revised,
                           ArrayMask mask,
                           MutableInteger midx,
                           Object[] values,
                           MutableInteger vidx)
                    throws IllegalAccessException
Applies the delta value (if any) to the provided objects.

Parameters:
midx - an in/out parameter representing the index in the mask.
vidx - an in/out parameter representing the index in the value array.
Throws:
IllegalAccessException

toString

public void toString(Field field,
                     ArrayMask mask,
                     MutableInteger midx,
                     Object[] values,
                     MutableInteger vidx,
                     StringBuilder buf)
Writes the delta value (if any) to the specified string.

Parameters:
midx - an in/out parameter representing the index in the mask.
vidx - an in/out parameter representing the index in the value array.