Top Description Inners Fields Constructors Methods
org.hibernate.collection.internal

public Class PersistentList

extends AbstractPersistentCollection
implements List
Class Inheritance
All Implemented Interfaces
java.util.List, java.util.SequencedCollection, java.util.Collection, java.lang.Iterable
Imports
java.io.Serializable, java.sql.ResultSet, .SQLException, java.util.ArrayList, .Collection, .Iterator, .List, .ListIterator, org.hibernate.HibernateException, org.hibernate.engine.spi.SessionImplementor, .SharedSessionContractImplementor, org.hibernate.loader.CollectionAliases, org.hibernate.persister.collection.CollectionPersister, org.hibernate.type.Type

A persistent wrapper for a java.util.List. Underlying collection is an ArrayList.
Author
Gavin King
See Also
java.util.ArrayList

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract class
pack-priv class
pack-priv class
pack-priv class
pack-priv class
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
protected List<E>
Inherited from org.hibernate.collection.internal.AbstractPersistentCollection:
elementRemovedUNKNOWN

Constructor Summary

AccessConstructor and Description
public
PersistentList()

Constructs a PersistentList.

public
PersistentList(SharedSessionContractImplementor
The session
session
)

Constructs a PersistentList.

public
PersistentList(SessionImplementor
The session
session
)

Deprecated PersistentList(SharedSessionContractImplementor) should be used instead.
Constructs a PersistentList.
public
PersistentList(SharedSessionContractImplementor
The session
session
,
List<E>
The raw list
list
)

Constructs a PersistentList.

public
PersistentList(SessionImplementor
The session
session
,
List<E>
The raw list
list
)

Deprecated PersistentList(SharedSessionContractImplementor, List) should be used instead.
Constructs a PersistentList.

Method Summary

Modifier and TypeMethod and Description
public boolean
add(Object
element to be appended to this list
object
)

Implements java.util.List.add.

Appends the specified element to the end of this list (optional operation).
public void
add(int
index at which the specified element is to be inserted
index
,
Object
element to be inserted
value
)

Implements java.util.List.add.

Inserts the specified element at the specified position in this list (optional operation).
public boolean
addAll(Collection<E>
collection containing elements to be added to this list
values
)

Implements java.util.List.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).
public boolean
addAll(int
index at which to insert the first element from the specified collection
index
,
Collection<E>
collection containing elements to be added to this list
coll
)

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).
public void
beforeInitialize(CollectionPersister
The underlying collection persister.
persister
,
int
The anticipated size of the collection after initialization is complete.
anticipatedSize
)

Implements org.hibernate.collection.spi.PersistentCollection.beforeInitialize.

Called before any elements are read into the collection, allowing appropriate initializations to occur.
public void
clear()

Implements java.util.List.clear.

Removes all of the elements from this list (optional operation).
public boolean
contains(Object
element whose presence in this list is to be tested
object
)

Implements java.util.List.contains.

Returns true if this list contains the specified element.
public boolean
containsAll(Collection<E>
collection to be checked for containment in this list
coll
)

Implements java.util.List.containsAll.

Returns true if this list contains all of the elements of the specified collection.
public Serializable
disassemble(CollectionPersister
The collection persister
persister
)

Implements org.hibernate.collection.spi.PersistentCollection.disassemble.

Disassemble the collection to get it ready for the cache
public boolean
public Iterator<E>
entries(CollectionPersister
The collection persister.
persister
)

Implements org.hibernate.collection.spi.PersistentCollection.entries.

Iterate all collection entries, during update of the database
public boolean
entryExists(Object
The object to check if it exists as a collection element
entry
,
int
Unused
i
)

Implements org.hibernate.collection.spi.PersistentCollection.entryExists.

Does the given element/entry exist in the collection?
public boolean
equals(Object
the object to be compared for equality with this list
other
)

Overrides java.lang.Object.equals.

Implements java.util.List.equals.

Compares the specified object with this list for equality.
public boolean
equalsSnapshot(CollectionPersister
The collection persister
persister
)

Implements org.hibernate.collection.spi.PersistentCollection.equalsSnapshot.

Does the current state exactly match the snapshot?
public Object
get(int
index of the element to return
index
)

Implements java.util.List.get.

Returns the element at the specified position in this list.
public Iterator<E>
getDeletes(CollectionPersister
The collection persister
persister
,
boolean
For indexed collections, tells whether the index is a formula (calculated value) mapping
indexIsFormula
)

Implements org.hibernate.collection.spi.PersistentCollection.getDeletes.

Get all the elements that need deleting
public Object
getElement(Object
The object instance for which to get the collection element instance.
entry
)

Implements org.hibernate.collection.spi.PersistentCollection.getElement.

Get the value of the given collection entry.
public Object
getIndex(Object
The collection entry/element
entry
,
int
The assumed index
i
,
CollectionPersister
it was more elegant before we added this...
persister
)

Implements org.hibernate.collection.spi.PersistentCollection.getIndex.

Get the index of the given collection entry
public Collection<E>
getOrphans(Serializable
The snapshot state
snapshot
,
String
The name of the entity that are the elements of the collection
entityName
)

Implements abstract org.hibernate.collection.internal.AbstractPersistentCollection.getOrphans.

Implements org.hibernate.collection.spi.PersistentCollection.getOrphans.

get all "orphaned" elements
public Serializable
getSnapshot(CollectionPersister
The collection persister
persister
)

Implements org.hibernate.collection.spi.PersistentCollection.getSnapshot.

Return a new snapshot of the current state of the collection
public Object
getSnapshotElement(Object
The entry
entry
,
int
The index
i
)

Implements org.hibernate.collection.spi.PersistentCollection.getSnapshotElement.

Get the snapshot value of the given collection entry
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.List.hashCode.

Returns the hash code value for this list.
public int
indexOf(Object
element to search for
value
)

Implements java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
public void
initializeFromCache(CollectionPersister
The collection persister
persister
,
Serializable
The disassembled cached state
disassembled
,
Object
The collection owner
owner
)

Implements org.hibernate.collection.spi.PersistentCollection.initializeFromCache.

Read the state of the collection from a disassembled cached value
public boolean
isEmpty()

Implements java.util.List.isEmpty.

Returns true if this list contains no elements.
public boolean
isSnapshotEmpty(Serializable
The snapshot to check
snapshot
)

Implements org.hibernate.collection.spi.PersistentCollection.isSnapshotEmpty.

Is the snapshot empty?
public boolean
isWrapper(Object
The collection to check whether this is wrapping it
collection
)

Implements org.hibernate.collection.spi.PersistentCollection.isWrapper.

Is this the wrapper for the given collection instance?
public Iterator<E>
iterator()

Implements java.util.List.iterator.

Returns an iterator over the elements in this list in proper sequence.
public int
lastIndexOf(Object
element to search for
value
)

Implements java.util.List.lastIndexOf.

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
public ListIterator<E>
listIterator()

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence).
public ListIterator<E>
listIterator(int
index of the first element to be returned from the list iterator (by a call to next)
index
)

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
public boolean
needsInserting(Object
The collection element to check
entry
,
int
The index (for indexed collections)
i
,
Type
The type for the element
elemType
)

Implements org.hibernate.collection.spi.PersistentCollection.needsInserting.

Do we need to insert this element?
public boolean
needsUpdating(Object
The collection element to check
entry
,
int
The index (for indexed collections)
i
,
Type
The type for the element
elemType
)

Implements org.hibernate.collection.spi.PersistentCollection.needsUpdating.

Do we need to update this element?
public Object
readFrom(ResultSet
The JDBC ResultSet
rs
,
CollectionPersister
The collection role
persister
,
CollectionAliases
The aliases used for the columns making up the collection
descriptor
,
Object
The collection owner
owner
)

Implements org.hibernate.collection.spi.PersistentCollection.readFrom.

Read a row from the JDBC result set
public boolean
remove(Object
element to be removed from this list, if present
value
)

Implements java.util.List.remove.

Removes the first occurrence of the specified element from this list, if it is present (optional operation).
public Object
remove(int
the index of the element to be removed
index
)

Implements java.util.List.remove.

Removes the element at the specified position in this list (optional operation).
public boolean
removeAll(Collection<E>
collection containing elements to be removed from this list
coll
)

Implements java.util.List.removeAll.

Removes from this list all of its elements that are contained in the specified collection (optional operation).
public boolean
retainAll(Collection<E>
collection containing elements to be retained in this list
coll
)

Implements java.util.List.retainAll.

Retains only the elements in this list that are contained in the specified collection (optional operation).
public Object
set(int
index of the element to replace
index
,
Object
element to be stored at the specified position
value
)

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).
public int
size()

Implements java.util.List.size.

Returns the number of elements in this list.
public List<E>
subList(int
low endpoint (inclusive) of the subList
from
,
int
high endpoint (exclusive) of the subList
to
)

Implements java.util.List.subList.

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
public Object[]
toArray()

Implements java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).
public Object[]
toArray(Object[]
the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
array
)

Implements java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.hibernate.collection.internal.AbstractPersistentCollection:
afterInitializeafterRowInsertbeginReadclearDirtyclearOperationQueuedirtyendReadforceInitializationgetCachedSizegetIdentifiergetKeygetOrphansgetOwnergetQueuedOrphansgetRolegetSessiongetSnapshotgetStoredSnapshotgetValuehasQueuedOperationsidentityRemoveidentityRemoveinitializeisClearQueueEnabledisConnectedToSessionisDirectlyAccessibleisDirtyisElementRemovedisInitializedisInverseCollectionisInverseCollectionNoOrphanDeleteisInverseOneToManyOrNoOrphanDeleteisOperationQueueEnabledisPutQueueEnabledisRowUpdatePossibleisUnreferencedneedsRecreateperformQueuedOperationspostActionpreInsertprepareForPossibleLoadingOutsideTransactionqueuedAdditionIteratorqueueOperationreadreadElementByIndexreadElementExistencereadIndexExistencereadSizereplaceQueuedOperationValuessetCurrentSessionsetDirectlyAccessiblesetInitializedsetOwnersetSnapshotunsetSessionwasInitializedwrite