站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

Set (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.collection
Class Set

java.lang.Object
  extended bynet.sf.hibernate.collection.PersistentCollection
      extended bynet.sf.hibernate.collection.ODMGCollection
          extended bynet.sf.hibernate.collection.Set
All Implemented Interfaces:
Collection, org.odmg.DCollection, org.odmg.DSet, Serializable, Set
Direct Known Subclasses:
SortedSet

public class Set
extends ODMGCollection
implements Set, org.odmg.DSet

A persistent wrapper for a java.util.Set. The underlying collection is a HashSet.

Author:
Gavin King
See Also:
HashSet, Serialized Form

Constructor Summary
Set()
           
Set(SessionImplementor session)
           
Set(SessionImplementor session, Set set)
           
 
Method Summary
 boolean add(Object value)
           
 boolean addAll(Collection coll)
           
 void beforeInitialize(CollectionPersister persister)
          Called before any elements are read into the collection, allowing appropriate initializations to occur.
 void beginRead()
          Called just before reading any rows from the JDBC result set
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection coll)
           
 org.odmg.DSet difference(org.odmg.DSet otherSet)
           
 Serializable disassemble(CollectionPersister persister)
          Disassemble the collection, ready for the cache
 boolean empty()
          Is the initialized collection empty?
 boolean endRead()
          Called after reading all rows from the JDBC result set
 Iterator entries()
          Iterate all collection entries, during update of the database
 boolean entryExists(Object key, int i)
          Does an element exist at this entry in the collection?
 boolean equals(Object other)
           
 boolean equalsSnapshot(Type elementType)
          Does the current state exactly match the snapshot?
 Iterator getDeletes(Type elemType)
          Get all the elements that need deleting
 Object getIndex(Object entry, int i)
          Get the index of the given collection entry
 Collection getOrphans(Serializable snapshot)
          get all "orphaned" elements
 int hashCode()
           
 void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
          Read the state of the collection from a disassembled cached value
 org.odmg.DSet intersection(org.odmg.DSet otherSet)
           
 boolean isEmpty()
           
 boolean isWrapper(Object collection)
          Is this the wrapper for the given underlying collection instance?
 Iterator iterator()
           
 boolean needsInserting(Object entry, int i, Type elemType)
          Do we need to insert this element?
 boolean needsUpdating(Object entry, int i, Type elemType)
          Do we need to update this element?
 boolean properSubsetOf(org.odmg.DSet otherSet)
           
 boolean properSupersetOf(org.odmg.DSet otherSet)
           
 Object readFrom(ResultSet rs, CollectionPersister persister, Object owner)
          Read a row from the JDBC result set
 boolean remove(Object value)
           
 boolean removeAll(Collection coll)
           
 boolean retainAll(Collection coll)
           
 int size()
           
protected  Serializable snapshot(CollectionPersister persister)
          Return a new snapshot of the current state
 boolean subsetOf(org.odmg.DSet otherSet)
           
 boolean supersetOf(org.odmg.DSet otherSet)
           
 Object[] toArray()
           
 Object[] toArray(Object[] array)
           
 String toString()
           
 org.odmg.DSet union(org.odmg.DSet otherSet)
           
 void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder)
          Write a row to the JDBC prepared statement
 
Methods inherited from class net.sf.hibernate.collection.ODMGCollection
existsElement, query, select, selectElement
 
Methods inherited from class net.sf.hibernate.collection.PersistentCollection
afterRowInsert, delayedAddAll, forceInitialization, getCollectionSnapshot, getOrphans, getSession, getSnapshot, getSnapshot, getValue, hasQueuedAdditions, initialize, isDirectlyAccessible, needsRecreate, postFlush, preInsert, queueAdd, queueAddAll, queuedAdditionIterator, read, setCollectionSnapshot, setCurrentSession, setDirectlyAccessible, setInitialized, unsetSession, wasInitialized, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.odmg.DCollection
existsElement, query, select, selectElement
 

Constructor Detail

Set

public Set(SessionImplementor session)

Set

public Set()

Set

public Set(SessionImplementor session,
           Set set)
Method Detail

snapshot

protected Serializable snapshot(CollectionPersister persister)
                         throws HibernateException
Description copied from class: PersistentCollection
Return a new snapshot of the current state

Specified by:
snapshot in class PersistentCollection
Throws:
HibernateException

getOrphans

public Collection getOrphans(Serializable snapshot)
                      throws HibernateException
Description copied from class: PersistentCollection
get all "orphaned" elements

Specified by:
getOrphans in class PersistentCollection
Throws:
HibernateException

equalsSnapshot

public boolean equalsSnapshot(Type elementType)
                       throws HibernateException
Description copied from class: PersistentCollection
Does the current state exactly match the snapshot?

Specified by:
equalsSnapshot in class PersistentCollection
Throws:
HibernateException

beforeInitialize

public void beforeInitialize(CollectionPersister persister)
Description copied from class: PersistentCollection
Called before any elements are read into the collection, allowing appropriate initializations to occur.

Specified by:
beforeInitialize in class PersistentCollection

initializeFromCache

public void initializeFromCache(CollectionPersister persister,
                                Serializable disassembled,
                                Object owner)
                         throws HibernateException
Description copied from class: PersistentCollection
Read the state of the collection from a disassembled cached value

Specified by:
initializeFromCache in class PersistentCollection
Throws:
HibernateException

empty

public boolean empty()
Description copied from class: PersistentCollection
Is the initialized collection empty?

Specified by:
empty in class PersistentCollection

size

public int size()
Specified by:
size in interface Set
See Also:
Set.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Set
See Also:
Set.isEmpty()

contains

public boolean contains(Object o)
Specified by:
contains in interface Set
See Also:
Set.contains(Object)

iterator

public Iterator iterator()
Specified by:
iterator in interface Set
See Also:
Set.iterator()

toArray

public Object[] toArray()
Specified by:
toArray in interface Set
See Also:
Set.toArray()

toArray

public Object[] toArray(Object[] array)
Specified by:
toArray in interface Set
See Also:
Set.toArray(Object[])

add

public boolean add(Object value)
Specified by:
add in interface Set
See Also:
Set.add(Object)

remove

public boolean remove(Object value)
Specified by:
remove in interface Set
See Also:
Set.remove(Object)

containsAll

public boolean containsAll(Collection coll)
Specified by:
containsAll in interface Set
See Also:
Set.containsAll(Collection)

addAll

public boolean addAll(Collection coll)
Specified by:
addAll in interface Set
See Also:
Set.addAll(Collection)

retainAll

public boolean retainAll(Collection coll)
Specified by:
retainAll in interface Set
See Also:
Set.retainAll(Collection)

removeAll

public boolean removeAll(Collection coll)
Specified by:
removeAll in interface Set
See Also:
Set.removeAll(Collection)

clear

public void clear()
Specified by:
clear in interface Set
See Also:
Set.clear()

toString

public String toString()

writeTo

public void writeTo(PreparedStatement st,
                    CollectionPersister persister,
                    Object entry,
                    int i,
                    boolean writeOrder)
             throws HibernateException,
                    SQLException
Description copied from class: PersistentCollection
Write a row to the JDBC prepared statement

Specified by:
writeTo in class PersistentCollection
Throws:
HibernateException
SQLException
See Also:
PersistentCollection.writeTo(PreparedStatement, CollectionPersister, Object, int, boolean)

readFrom

public Object readFrom(ResultSet rs,
                       CollectionPersister persister,
                       Object owner)
                throws HibernateException,
                       SQLException
Description copied from class: PersistentCollection
Read a row from the JDBC result set

Specified by:
readFrom in class PersistentCollection
Throws:
HibernateException
SQLException
See Also:
PersistentCollection.readFrom(ResultSet, CollectionPersister, Object)

beginRead

public void beginRead()
Description copied from class: PersistentCollection
Called just before reading any rows from the JDBC result set

Overrides:
beginRead in class PersistentCollection

endRead

public boolean endRead()
Description copied from class: PersistentCollection
Called after reading all rows from the JDBC result set

Overrides:
endRead in class PersistentCollection

entries

public Iterator entries()
Description copied from class: PersistentCollection
Iterate all collection entries, during update of the database

Specified by:
entries in class PersistentCollection
See Also:
PersistentCollection.entries()

disassemble

public Serializable disassemble(CollectionPersister persister)
                         throws HibernateException
Description copied from class: PersistentCollection
Disassemble the collection, ready for the cache

Specified by:
disassemble in class PersistentCollection
Throws:
HibernateException

getDeletes

public Iterator getDeletes(Type elemType)
                    throws HibernateException
Description copied from class: PersistentCollection
Get all the elements that need deleting

Specified by:
getDeletes in class PersistentCollection
Throws:
HibernateException

needsInserting

public boolean needsInserting(Object entry,
                              int i,
                              Type elemType)
                       throws HibernateException
Description copied from class: PersistentCollection
Do we need to insert this element?

Specified by:
needsInserting in class PersistentCollection
Throws:
HibernateException

needsUpdating

public boolean needsUpdating(Object entry,
                             int i,
                             Type elemType)
Description copied from class: PersistentCollection
Do we need to update this element?

Specified by:
needsUpdating in class PersistentCollection

getIndex

public Object getIndex(Object entry,
                       int i)
Description copied from class: PersistentCollection
Get the index of the given collection entry

Specified by:
getIndex in class PersistentCollection

union

public org.odmg.DSet union(org.odmg.DSet otherSet)
Specified by:
union in interface org.odmg.DSet
See Also:
DSet.union(DSet)

difference

public org.odmg.DSet difference(org.odmg.DSet otherSet)
Specified by:
difference in interface org.odmg.DSet
See Also:
DSet.difference(DSet)

intersection

public org.odmg.DSet intersection(org.odmg.DSet otherSet)
Specified by:
intersection in interface org.odmg.DSet
See Also:
DSet.intersection(DSet)

properSubsetOf

public boolean properSubsetOf(org.odmg.DSet otherSet)
Specified by:
properSubsetOf in interface org.odmg.DSet
See Also:
DSet.properSubsetOf(DSet)

properSupersetOf

public boolean properSupersetOf(org.odmg.DSet otherSet)
Specified by:
properSupersetOf in interface org.odmg.DSet
See Also:
DSet.properSupersetOf(DSet)

subsetOf

public boolean subsetOf(org.odmg.DSet otherSet)
Specified by:
subsetOf in interface org.odmg.DSet
See Also:
DSet.subsetOf(DSet)

supersetOf

public boolean supersetOf(org.odmg.DSet otherSet)
Specified by:
supersetOf in interface org.odmg.DSet
See Also:
DSet.supersetOf(DSet)

equals

public boolean equals(Object other)
Specified by:
equals in interface Set

hashCode

public int hashCode()
Specified by:
hashCode in interface Set

entryExists

public boolean entryExists(Object key,
                           int i)
Description copied from class: PersistentCollection
Does an element exist at this entry in the collection?

Specified by:
entryExists in class PersistentCollection
See Also:
PersistentCollection.entryExists(java.lang.Object, int)

isWrapper

public boolean isWrapper(Object collection)
Description copied from class: PersistentCollection
Is this the wrapper for the given underlying collection instance?

Specified by:
isWrapper in class PersistentCollection