net.spy.db.savables
Class SavableHashSet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byjava.util.HashSet
              extended bynet.spy.db.savables.SavableHashSet
All Implemented Interfaces:
Cloneable, Collection, Savable, SavableNode, Serializable, Set

public class SavableHashSet
extends HashSet
implements SavableNode

A subclass of HashSet that implements SavableNode. The save() method does nothing (and should not be called), but all of the objects in the Set will be returned from getPostSavables().

Author:
Dustin Sallings
See Also:
Serialized Form

Constructor Summary
SavableHashSet()
          Get an instance of SavableHashSet.
SavableHashSet(Collection col)
          Get an instance of SavableHashSet populated with the given Collection of objects.
SavableHashSet(int initCap)
          Get an instance of SavableHashSet with the given initial capacity.
SavableHashSet(int initialCapacity, float loadFactor)
          Get an instance of SavableHashSet with the given initial capacity and load factors.
 
Method Summary
 Collection getPostSavables(SaveContext context)
          Get a Collection of all of the SavableNodes this SavableNode is holding that will need to be saved after this Savable.
 Collection getPreSavables(SaveContext context)
          Get a Collection of all of the SavableNodes this SavableNode is holding that will need to be saved before this Savable.
 Collection getSavables(SaveContext context)
          This method is deprecated and should return the same value as getPostSavables.
 boolean isModified()
          Has this object been modified?
 boolean isNew()
          Is this a new object?
 void save(Connection conn, SaveContext context)
          Do nothing.
 
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

SavableHashSet

public SavableHashSet()
Get an instance of SavableHashSet.


SavableHashSet

public SavableHashSet(Collection col)
Get an instance of SavableHashSet populated with the given Collection of objects.


SavableHashSet

public SavableHashSet(int initCap)
Get an instance of SavableHashSet with the given initial capacity.


SavableHashSet

public SavableHashSet(int initialCapacity,
                      float loadFactor)
Get an instance of SavableHashSet with the given initial capacity and load factors.

Method Detail

isNew

public boolean isNew()
Description copied from interface: Savable
Is this a new object?

Specified by:
isNew in interface Savable
Returns:
false

isModified

public boolean isModified()
Description copied from interface: Savable
Has this object been modified?

Specified by:
isModified in interface Savable
Returns:
false

save

public void save(Connection conn,
                 SaveContext context)
          throws SaveException,
                 SQLException
Do nothing.

Specified by:
save in interface Savable
Parameters:
conn - the connection to use for saving
context - SaveContext being used in this Saver session
Throws:
SaveException
SQLException

getPreSavables

public Collection getPreSavables(SaveContext context)
Description copied from interface: SavableNode
Get a Collection of all of the SavableNodes this SavableNode is holding that will need to be saved before this Savable.

Specified by:
getPreSavables in interface SavableNode
Parameters:
context - SaveContext being used in this Saver session
Returns:
null

getPostSavables

public Collection getPostSavables(SaveContext context)
Description copied from interface: SavableNode
Get a Collection of all of the SavableNodes this SavableNode is holding that will need to be saved after this Savable.

Specified by:
getPostSavables in interface SavableNode
Parameters:
context - SaveContext being used in this Saver session
Returns:
this

getSavables

public Collection getSavables(SaveContext context)
Description copied from interface: SavableNode
This method is deprecated and should return the same value as getPostSavables.

Specified by:
getSavables in interface SavableNode
Returns:
this