|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.collection.AbstractPersistentCollection
org.hibernate.collection.PersistentBag
public class PersistentBag
An unordered, unkeyed collection that can contain the same element multiple times. The Java collections API, curiously, has no Bag. Most developers seem to use Lists to represent bag semantics, so Hibernate follows this practice.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.hibernate.collection.AbstractPersistentCollection |
|---|
AbstractPersistentCollection.DelayedOperation |
| Field Summary | |
|---|---|
protected java.util.List |
bag
|
| Fields inherited from class org.hibernate.collection.AbstractPersistentCollection |
|---|
UNKNOWN |
| Constructor Summary | |
|---|---|
PersistentBag()
|
|
PersistentBag(SessionImplementor session)
|
|
PersistentBag(SessionImplementor session,
java.util.Collection coll)
|
|
| Method Summary | |
|---|---|
void |
add(int i,
java.lang.Object o)
|
boolean |
add(java.lang.Object object)
|
boolean |
addAll(java.util.Collection values)
|
boolean |
addAll(int i,
java.util.Collection c)
|
void |
beforeInitialize(CollectionPersister persister,
int anticipatedSize)
Called before any elements are read into the collection, allowing appropriate initializations to occur. |
void |
clear()
|
boolean |
contains(java.lang.Object object)
|
boolean |
containsAll(java.util.Collection c)
|
java.io.Serializable |
disassemble(CollectionPersister persister)
Disassemble the collection, ready for the cache |
boolean |
empty()
Is the initialized collection empty? |
java.util.Iterator |
entries(CollectionPersister persister)
Iterate all collection entries, during update of the database |
boolean |
entryExists(java.lang.Object entry,
int i)
Does an element exist at this entry in the collection? |
boolean |
equals(java.lang.Object obj)
Bag does not respect the collection API and do an JVM instance comparison to do the equals. |
boolean |
equalsSnapshot(CollectionPersister persister)
Does the current state exactly match the snapshot? |
java.lang.Object |
get(int i)
|
java.util.Iterator |
getDeletes(CollectionPersister persister,
boolean indexIsFormula)
Get all the elements that need deleting |
java.lang.Object |
getElement(java.lang.Object entry)
Get the value of the given collection entry |
java.lang.Object |
getIndex(java.lang.Object entry,
int i,
CollectionPersister persister)
Get the index of the given collection entry |
java.util.Collection |
getOrphans(java.io.Serializable snapshot,
java.lang.String entityName)
get all "orphaned" elements |
java.io.Serializable |
getSnapshot(CollectionPersister persister)
Return a new snapshot of the current state of the collection |
java.lang.Object |
getSnapshotElement(java.lang.Object entry,
int i)
Get the snapshot value of the given collection entry |
int |
hashCode()
|
int |
indexOf(java.lang.Object o)
|
void |
initializeFromCache(CollectionPersister persister,
java.io.Serializable disassembled,
java.lang.Object owner)
Read the state of the collection from a disassembled cached value |
boolean |
isEmpty()
|
boolean |
isRowUpdatePossible()
|
boolean |
isSnapshotEmpty(java.io.Serializable snapshot)
Is the snapshot empty? |
boolean |
isWrapper(java.lang.Object collection)
Is this the wrapper for the given underlying collection instance? |
java.util.Iterator |
iterator()
|
int |
lastIndexOf(java.lang.Object o)
|
java.util.ListIterator |
listIterator()
|
java.util.ListIterator |
listIterator(int i)
|
boolean |
needsInserting(java.lang.Object entry,
int i,
Type elemType)
Do we need to insert this element? |
boolean |
needsRecreate(CollectionPersister persister)
Do we need to completely recreate this collection when it changes? |
boolean |
needsUpdating(java.lang.Object entry,
int i,
Type elemType)
Do we need to update this element? |
int |
occurrences(java.lang.Object o)
|
java.lang.Object |
readFrom(java.sql.ResultSet rs,
CollectionPersister persister,
CollectionAliases descriptor,
java.lang.Object owner)
Read a row from the JDBC result set |
java.lang.Object |
remove(int i)
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
boolean |
retainAll(java.util.Collection c)
|
java.lang.Object |
set(int i,
java.lang.Object o)
|
int |
size()
|
java.util.List |
subList(int start,
int end)
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.List bag
| Constructor Detail |
|---|
public PersistentBag(SessionImplementor session)
public PersistentBag(SessionImplementor session,
java.util.Collection coll)
public PersistentBag()
| Method Detail |
|---|
public boolean isWrapper(java.lang.Object collection)
PersistentCollection
isWrapper in interface PersistentCollectionpublic boolean empty()
AbstractPersistentCollection
empty in interface PersistentCollectionempty in class AbstractPersistentCollectionpublic java.util.Iterator entries(CollectionPersister persister)
PersistentCollection
entries in interface PersistentCollection
public java.lang.Object readFrom(java.sql.ResultSet rs,
CollectionPersister persister,
CollectionAliases descriptor,
java.lang.Object owner)
throws HibernateException,
java.sql.SQLException
PersistentCollection
readFrom in interface PersistentCollectionHibernateException
java.sql.SQLException
public void beforeInitialize(CollectionPersister persister,
int anticipatedSize)
PersistentCollection
beforeInitialize in interface PersistentCollectionpersister - The underlying collection persister.anticipatedSize - The anticipated size of the collection after initilization is complete.
public boolean equalsSnapshot(CollectionPersister persister)
throws HibernateException
PersistentCollection
equalsSnapshot in interface PersistentCollectionHibernateExceptionpublic boolean isSnapshotEmpty(java.io.Serializable snapshot)
PersistentCollection
isSnapshotEmpty in interface PersistentCollection
public java.io.Serializable getSnapshot(CollectionPersister persister)
throws HibernateException
PersistentCollection
getSnapshot in interface PersistentCollectionHibernateException
public java.util.Collection getOrphans(java.io.Serializable snapshot,
java.lang.String entityName)
throws HibernateException
AbstractPersistentCollection
getOrphans in interface PersistentCollectiongetOrphans in class AbstractPersistentCollectionHibernateException
public java.io.Serializable disassemble(CollectionPersister persister)
throws HibernateException
PersistentCollection
disassemble in interface PersistentCollectionHibernateException
public void initializeFromCache(CollectionPersister persister,
java.io.Serializable disassembled,
java.lang.Object owner)
throws HibernateException
PersistentCollection
initializeFromCache in interface PersistentCollectionHibernateExceptionpublic boolean needsRecreate(CollectionPersister persister)
AbstractPersistentCollection
needsRecreate in interface PersistentCollectionneedsRecreate in class AbstractPersistentCollection
public java.util.Iterator getDeletes(CollectionPersister persister,
boolean indexIsFormula)
throws HibernateException
PersistentCollection
getDeletes in interface PersistentCollectionHibernateException
public boolean needsInserting(java.lang.Object entry,
int i,
Type elemType)
throws HibernateException
PersistentCollection
needsInserting in interface PersistentCollectionHibernateExceptionpublic boolean isRowUpdatePossible()
isRowUpdatePossible in interface PersistentCollectionisRowUpdatePossible in class AbstractPersistentCollection
public boolean needsUpdating(java.lang.Object entry,
int i,
Type elemType)
PersistentCollection
needsUpdating in interface PersistentCollectionpublic int size()
size in interface java.util.Collectionsize in interface java.util.ListCollection.size()public boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.ListCollection.isEmpty()public boolean contains(java.lang.Object object)
contains in interface java.util.Collectioncontains in interface java.util.ListCollection.contains(Object)public java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.ListCollection.iterator()public java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.ListCollection.toArray()public java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.CollectiontoArray in interface java.util.ListCollection.toArray(Object[])public boolean add(java.lang.Object object)
add in interface java.util.Collectionadd in interface java.util.ListCollection.add(Object)public boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.ListCollection.remove(Object)public boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.ListCollection.containsAll(Collection)public boolean addAll(java.util.Collection values)
addAll in interface java.util.CollectionaddAll in interface java.util.ListCollection.addAll(Collection)public boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.ListCollection.removeAll(Collection)public boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.ListCollection.retainAll(Collection)public void clear()
clear in interface java.util.Collectionclear in interface java.util.ListCollection.clear()
public java.lang.Object getIndex(java.lang.Object entry,
int i,
CollectionPersister persister)
PersistentCollection
getIndex in interface PersistentCollectionpersister - it was more elegant before we added this...public java.lang.Object getElement(java.lang.Object entry)
PersistentCollection
getElement in interface PersistentCollection
public java.lang.Object getSnapshotElement(java.lang.Object entry,
int i)
PersistentCollection
getSnapshotElement in interface PersistentCollectionpublic int occurrences(java.lang.Object o)
public void add(int i,
java.lang.Object o)
add in interface java.util.ListList.add(int, Object)
public boolean addAll(int i,
java.util.Collection c)
addAll in interface java.util.ListList.addAll(int, Collection)public java.lang.Object get(int i)
get in interface java.util.ListList.get(int)public int indexOf(java.lang.Object o)
indexOf in interface java.util.ListList.indexOf(Object)public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.ListList.lastIndexOf(Object)public java.util.ListIterator listIterator()
listIterator in interface java.util.ListList.listIterator()public java.util.ListIterator listIterator(int i)
listIterator in interface java.util.ListList.listIterator(int)public java.lang.Object remove(int i)
remove in interface java.util.ListList.remove(int)
public java.lang.Object set(int i,
java.lang.Object o)
set in interface java.util.ListList.set(int, Object)
public java.util.List subList(int start,
int end)
subList in interface java.util.ListList.subList(int, int)public java.lang.String toString()
toString in class java.lang.Object
public boolean entryExists(java.lang.Object entry,
int i)
PersistentCollection
entryExists in interface PersistentCollectionpublic boolean equals(java.lang.Object obj)
equals in interface java.util.Collectionequals in interface java.util.Listequals in class java.lang.ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in interface java.util.CollectionhashCode in interface java.util.ListhashCode in class java.lang.ObjectObject.hashCode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||