org.apache.gora.persistency.impl
Class StateManagerImpl

java.lang.Object
  extended by org.apache.gora.persistency.impl.StateManagerImpl
All Implemented Interfaces:
StateManager

public class StateManagerImpl
extends Object
implements StateManager

An implementation for the StateManager. This implementation assumes every Persistent object has it's own StateManager.


Field Summary
protected  BitSet dirtyBits
           
protected  boolean isNew
           
protected  BitSet readableBits
           
 
Constructor Summary
StateManagerImpl()
           
 
Method Summary
 void clearDirty(Persistent persistent)
          Clears the dirty state.
 void clearDirty(Persistent persistent, int fieldIndex)
          Clears the field as dirty.
 void clearNew(Persistent persistent)
          Clears the new state
 void clearReadable(Persistent persistent)
          Clears the readable state.
 void clearReadable(Persistent persistent, int fieldIndex)
          Clears the field as readable.
 boolean isDirty(Persistent persistent)
          Returns whether any of the fields of the object has been modified after construction or loading.
 boolean isDirty(Persistent persistent, int fieldIndex)
          Returns whether the field has been modified.
 boolean isNew(Persistent persistent)
          Returns whether the object is newly constructed.
 boolean isReadable(Persistent persistent, int fieldIndex)
          Returns whether the field has been loaded from the datastore.
 void setDirty(Persistent persistent)
          Sets all the fields of the object as dirty.
 void setDirty(Persistent persistent, int fieldIndex)
          Sets the field as dirty.
 void setManagedPersistent(Persistent persistent)
          If one state manager is allocated per persistent object, call this method to set the managed persistent.
 void setNew(Persistent persistent)
          Sets the state of the object as new for persistency
 void setReadable(Persistent persistent, int fieldIndex)
          Sets the field as readable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isNew

protected boolean isNew

dirtyBits

protected BitSet dirtyBits

readableBits

protected BitSet readableBits
Constructor Detail

StateManagerImpl

public StateManagerImpl()
Method Detail

setManagedPersistent

public void setManagedPersistent(Persistent persistent)
Description copied from interface: StateManager
If one state manager is allocated per persistent object, call this method to set the managed persistent.

Specified by:
setManagedPersistent in interface StateManager
Parameters:
persistent - the persistent to manage

isNew

public boolean isNew(Persistent persistent)
Description copied from interface: StateManager
Returns whether the object is newly constructed.

Specified by:
isNew in interface StateManager
Returns:
true if the object is newly constructed, false if retrieved from a datastore.

setNew

public void setNew(Persistent persistent)
Description copied from interface: StateManager
Sets the state of the object as new for persistency

Specified by:
setNew in interface StateManager

clearNew

public void clearNew(Persistent persistent)
Description copied from interface: StateManager
Clears the new state

Specified by:
clearNew in interface StateManager

setDirty

public void setDirty(Persistent persistent,
                     int fieldIndex)
Description copied from interface: StateManager
Sets the field as dirty.

Specified by:
setDirty in interface StateManager
fieldIndex - the offset of the field in the object

isDirty

public boolean isDirty(Persistent persistent,
                       int fieldIndex)
Description copied from interface: StateManager
Returns whether the field has been modified.

Specified by:
isDirty in interface StateManager
fieldIndex - the offset of the field in the object
Returns:
whether the field has been modified.

isDirty

public boolean isDirty(Persistent persistent)
Description copied from interface: StateManager
Returns whether any of the fields of the object has been modified after construction or loading.

Specified by:
isDirty in interface StateManager
Returns:
whether any of the fields of the object has changed

setDirty

public void setDirty(Persistent persistent)
Description copied from interface: StateManager
Sets all the fields of the object as dirty.

Specified by:
setDirty in interface StateManager

clearDirty

public void clearDirty(Persistent persistent,
                       int fieldIndex)
Description copied from interface: StateManager
Clears the field as dirty.

Specified by:
clearDirty in interface StateManager
fieldIndex - the offset of the field in the object

clearDirty

public void clearDirty(Persistent persistent)
Description copied from interface: StateManager
Clears the dirty state.

Specified by:
clearDirty in interface StateManager

setReadable

public void setReadable(Persistent persistent,
                        int fieldIndex)
Description copied from interface: StateManager
Sets the field as readable.

Specified by:
setReadable in interface StateManager
fieldIndex - the offset of the field in the object

isReadable

public boolean isReadable(Persistent persistent,
                          int fieldIndex)
Description copied from interface: StateManager
Returns whether the field has been loaded from the datastore.

Specified by:
isReadable in interface StateManager
fieldIndex - the offset of the field in the object
Returns:
whether the field has been loaded

clearReadable

public void clearReadable(Persistent persistent,
                          int fieldIndex)
Description copied from interface: StateManager
Clears the field as readable.

Specified by:
clearReadable in interface StateManager
fieldIndex - the offset of the field in the object

clearReadable

public void clearReadable(Persistent persistent)
Description copied from interface: StateManager
Clears the readable state.

Specified by:
clearReadable in interface StateManager


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.