Class WTHashSet

java.lang.Object
java.util.AbstractCollection
wt.fc.collections.AbstractWTCollection
wt.fc.collections.WTHashSet
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Iterable, Collection, Set, wt.fc.collections.ReferenceBased, WTCollection, WTSet, ResultProcessor, Evolvable

public class WTHashSet extends wt.fc.collections.AbstractWTCollection implements Cloneable, ResultProcessor, WTSet, Evolvable
A hash-based implementation of WTSet.

WTHashSet implements wt.fc.ResultProcessor to provide better integration with the persistence layer. By implementing ResultProcessor, the default collections can be used in place of a QueryResult when retrieving data. The APIs to accomplish this are:

 PersistenceManager.find(StatementSpec, ResultProcessor)
 PersisenceManagerSvr.query(StatementSpec, ResultProcessor)
 

In addition to a no-arg clone method, WTHashSet provides a "deep" clone in which the references are copied and the Persistables in the set are cloned using PersistenceCloner.

A WTHashSet can be constructed with a key mask. The default key mask is CollectionsHelper.OBJECT_IDENTIFIER.

Note: this class is Evolvable. You probably don't want to take advantage of this, though, because what you've really got is an association and you should just accept that, model it, and let the system handle data integrity for you. But, if you ignore this advice, be aware that only the references themselves (and not their persistables) will be blobbed (unless the object hasn't been persisted, in which case it'll attempt to blob the entire persistable and fail (unless the persistable itself is Evolvable)) and that nobody's guaranteeing the objects being referred to will still be around when you later de-blob the collection and attempt to inflate the references.

Supported API: true

Extendable: false

See Also:
  • Constructor Details

    • WTHashSet

      public WTHashSet()


      Supported API: true
    • WTHashSet

      public WTHashSet(int initial_capacity)


      Supported API: true
      Parameters:
      initial_capacity -
    • WTHashSet

      public WTHashSet(int initial_capacity, int key_mask)


      Supported API: true
      Parameters:
      initial_capacity -
      key_mask -
    • WTHashSet

      public WTHashSet(Collection c)


      Supported API: true
      Parameters:
      c -
    • WTHashSet

      public WTHashSet(Collection c, int key_mask)


      Supported API: true
      Parameters:
      c -
      key_mask -
  • Method Details

    • clone

      public Object clone()


      Supported API: true
      Overrides:
      clone in class Object
      Returns:
      Object
    • clone

      public WTHashSet clone(boolean deep)


      Supported API: true
      Parameters:
      deep -
      Returns:
      WTHashSet
    • persistableIterator

      public Iterator persistableIterator() throws WTException
      Returns an iterator over the objects in this collection, as Persistables. Inflates all the QueryKeys and references in this collection that don't have Persistables yet. Persistables that are already in the collection are not refreshed.

      Supported API: true
      Specified by:
      persistableIterator in interface WTCollection
      Specified by:
      persistableIterator in class wt.fc.collections.AbstractWTCollection
      Returns:
      Iterator
      Throws:
      WTException