org.hibernate.collection
Class PersistentIndexedElementHolder

java.lang.Object
  extended by org.hibernate.collection.AbstractPersistentCollection
      extended by org.hibernate.collection.PersistentIndexedElementHolder
All Implemented Interfaces:
Serializable, PersistentCollection
Direct Known Subclasses:
PersistentListElementHolder, PersistentMapElementHolder

public abstract class PersistentIndexedElementHolder
extends AbstractPersistentCollection

A persistent wrapper for an XML element

Author:
Gavin King
See Also:
Serialized Form

Nested Class Summary
static class PersistentIndexedElementHolder.IndexedValue
           
 
Nested classes/interfaces inherited from class org.hibernate.collection.AbstractPersistentCollection
AbstractPersistentCollection.DelayedOperation
 
Field Summary
protected  org.dom4j.Element element
           
 
Fields inherited from class org.hibernate.collection.AbstractPersistentCollection
UNKNOWN
 
Constructor Summary
PersistentIndexedElementHolder(SessionImplementor session, CollectionPersister persister, Serializable key)
           
PersistentIndexedElementHolder(SessionImplementor session, org.dom4j.Element element)
           
 
Method Summary
 void beforeInitialize(CollectionPersister persister, int anticipatedSize)
          Called before any elements are read into the collection, allowing appropriate initializations to occur.
 boolean empty()
          Is the initialized collection empty?
 Iterator entries(CollectionPersister persister)
          Iterate all collection entries, during update of the database
 boolean entryExists(Object entry, int i)
          Does an element exist at this entry in the collection?
 boolean equalsSnapshot(CollectionPersister persister)
          Does the current state exactly match the snapshot?
 Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula)
          Get all the elements that need deleting
 Object getElement(Object entry)
          Get the value of the given collection entry
protected static String getIndex(org.dom4j.Element element, String indexNodeName, int i)
           
 Object getIndex(Object entry, int i, CollectionPersister persister)
          Get the index of the given collection entry
protected static String getIndexAttributeName(CollectionPersister persister)
           
 Collection getOrphans(Serializable snapshot, String entityName)
          get all "orphaned" elements
 Serializable getSnapshot(CollectionPersister persister)
          Return a new snapshot of the current state of the collection
 Object getSnapshotElement(Object entry, int i)
          Get the snapshot value of the given collection entry
 Object getValue()
          return the user-visible collection (or array) instance
 boolean isDirectlyAccessible()
          Could the application possibly have a direct reference to the underlying collection implementation?
 boolean isSnapshotEmpty(Serializable snapshot)
          Is the snapshot empty?
 boolean isWrapper(Object collection)
          Is this the wrapper for the given underlying collection instance?
 boolean needsInserting(Object entry, int i, Type elementType)
          Do we need to insert this element?
 boolean needsUpdating(Object entry, int i, Type elementType)
          Do we need to update this element?
 Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
          Read a row from the JDBC result set
protected static void setIndex(org.dom4j.Element element, String indexNodeName, String index)
           
 
Methods inherited from class org.hibernate.collection.AbstractPersistentCollection
afterInitialize, afterRowInsert, beginRead, clearDirty, dirty, endRead, forceInitialization, getCachedSize, getIdentifier, getKey, getOrphans, getOwner, getQueuedOrphans, getRole, getSession, getSnapshot, getStoredSnapshot, hasQueuedOperations, initialize, isClearQueueEnabled, isDirty, isOperationQueueEnabled, isPutQueueEnabled, isRowUpdatePossible, isUnreferenced, needsRecreate, performQueuedOperations, postAction, preInsert, queuedAdditionIterator, queueOperation, read, readElementByIndex, readElementExistence, readIndexExistence, readSize, setCurrentSession, setDirectlyAccessible, setInitialized, setOwner, setSnapshot, unsetSession, wasInitialized, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.collection.PersistentCollection
disassemble, initializeFromCache
 

Field Detail

element

protected org.dom4j.Element element
Constructor Detail

PersistentIndexedElementHolder

public PersistentIndexedElementHolder(SessionImplementor session,
                                      org.dom4j.Element element)

PersistentIndexedElementHolder

public PersistentIndexedElementHolder(SessionImplementor session,
                                      CollectionPersister persister,
                                      Serializable key)
                               throws HibernateException
Throws:
HibernateException
Method Detail

getIndex

protected static String getIndex(org.dom4j.Element element,
                                 String indexNodeName,
                                 int i)

setIndex

protected static void setIndex(org.dom4j.Element element,
                               String indexNodeName,
                               String index)

getIndexAttributeName

protected static String getIndexAttributeName(CollectionPersister persister)

getSnapshot

public Serializable getSnapshot(CollectionPersister persister)
                         throws HibernateException
Description copied from interface: PersistentCollection
Return a new snapshot of the current state of the collection

Throws:
HibernateException

getOrphans

public Collection getOrphans(Serializable snapshot,
                             String entityName)
                      throws HibernateException
Description copied from class: AbstractPersistentCollection
get all "orphaned" elements

Specified by:
getOrphans in interface PersistentCollection
Specified by:
getOrphans in class AbstractPersistentCollection
Throws:
HibernateException

isWrapper

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


equalsSnapshot

public boolean equalsSnapshot(CollectionPersister persister)
                       throws HibernateException
Description copied from interface: PersistentCollection
Does the current state exactly match the snapshot?

Throws:
HibernateException

isSnapshotEmpty

public boolean isSnapshotEmpty(Serializable snapshot)
Description copied from interface: PersistentCollection
Is the snapshot empty?


empty

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

Specified by:
empty in interface PersistentCollection
Specified by:
empty in class AbstractPersistentCollection

readFrom

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

Throws:
HibernateException
SQLException

entries

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


beforeInitialize

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

Parameters:
persister - The underlying collection persister.
anticipatedSize - The anticipated size of the collection after initilization is complete.

isDirectlyAccessible

public boolean isDirectlyAccessible()
Description copied from class: AbstractPersistentCollection
Could the application possibly have a direct reference to the underlying collection implementation?

Specified by:
isDirectlyAccessible in interface PersistentCollection
Overrides:
isDirectlyAccessible in class AbstractPersistentCollection

getValue

public Object getValue()
Description copied from class: AbstractPersistentCollection
return the user-visible collection (or array) instance

Specified by:
getValue in interface PersistentCollection
Overrides:
getValue in class AbstractPersistentCollection

getDeletes

public Iterator getDeletes(CollectionPersister persister,
                           boolean indexIsFormula)
                    throws HibernateException
Description copied from interface: PersistentCollection
Get all the elements that need deleting

Throws:
HibernateException

needsInserting

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

Throws:
HibernateException

needsUpdating

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

Throws:
HibernateException

getIndex

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

persister - it was more elegant before we added this...

getElement

public Object getElement(Object entry)
Description copied from interface: PersistentCollection
Get the value of the given collection entry


getSnapshotElement

public Object getSnapshotElement(Object entry,
                                 int i)
Description copied from interface: PersistentCollection
Get the snapshot value of the given collection entry


entryExists

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