net.spy.db
Class AbstractSavable

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.db.AbstractSavable
All Implemented Interfaces:
Savable
Direct Known Subclasses:
CollectionSavable

public abstract class AbstractSavable
extends SpyObject
implements Savable

Abstract implementation of Savable.


Constructor Summary
protected AbstractSavable()
          Get an instance of AbstractSavable.
 
Method Summary
protected  void finalize()
          If this object is still dirty during finalization, log it.
 java.util.Collection getPostSavables(SaveContext context)
          Get the dependent objects for this Savable.
 java.util.Collection getPreSavables(SaveContext context)
          Get the objects that need to be saved before this object.
 boolean isModified()
          Indicate whether this object has been modified.
 boolean isNew()
          Indicate whether this object is new.
 void modify()
          Mark this AbstractSavable as modified.
protected  void setModified(boolean to)
          Set the ``modified'' flag for this object.
protected  void setNew(boolean to)
          Set the ``new'' flag for this object.
protected  void setSaved()
          Unset the flags indicating that this object needs to be saved.
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.spy.db.Savable
save
 

Constructor Detail

AbstractSavable

protected AbstractSavable()
Get an instance of AbstractSavable. An object instantiated with this constructor will have the new flag set. If this is not desirable, unset it.

Method Detail

isNew

public boolean isNew()
Indicate whether this object is new.

Specified by:
isNew in interface Savable

isModified

public boolean isModified()
Indicate whether this object has been modified.

Specified by:
isModified in interface Savable

setNew

protected void setNew(boolean to)
Set the ``new'' flag for this object.

Parameters:
to - the new value of the new flag

setModified

protected void setModified(boolean to)
Set the ``modified'' flag for this object.

Parameters:
to - the new value for the modified flag

modify

public void modify()
Mark this AbstractSavable as modified.


getPreSavables

public java.util.Collection getPreSavables(SaveContext context)
Get the objects that need to be saved before this object. The default implementation returns null, indicating that there are no prerequisite objects.

Specified by:
getPreSavables in interface Savable
Parameters:
context - SaveContext being used in this Saver session
Returns:
a collection of objects this SavableNode depends on

getPostSavables

public java.util.Collection getPostSavables(SaveContext context)
Get the dependent objects for this Savable. The default implementation returns null, indicating that there are no dependent objects.

Specified by:
getPostSavables in interface Savable
Parameters:
context - SaveContext being used in this Saver session
Returns:
a collection of objects this SavableNode depends on

setSaved

protected void setSaved()
Unset the flags indicating that this object needs to be saved.


finalize

protected void finalize()
                 throws java.lang.Throwable
If this object is still dirty during finalization, log it.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © 1995-2006 SPY Internetworking. All Rights Reserved.