Package org.apache.cayenne.util
Class PersistentObjectList<E>
java.lang.Object
org.apache.cayenne.util.RelationshipFault<E>
org.apache.cayenne.util.PersistentObjectList<E>
- All Implemented Interfaces:
- Serializable,- Iterable<E>,- Collection<E>,- List<E>,- PersistentObjectCollection<E>,- ValueHolder<List<E>>
- Direct Known Subclasses:
- ToManyList
public class PersistentObjectList<E> extends RelationshipFault<E> implements List<E>, ValueHolder<List<E>>, PersistentObjectCollection<E>
A list of persistent objects lazily resolved on the first access.
- Since:
- 1.2
- See Also:
- Serialized Form
- 
Field SummaryFields Modifier and Type Field Description protected LinkedList<E>addedToUnresolvedprotected List<E>objectListprotected LinkedList<E>removedFromUnresolvedFields inherited from class org.apache.cayenne.util.RelationshipFaultrelationshipName, relationshipOwner
- 
Constructor SummaryConstructors Constructor Description PersistentObjectList(Persistent relationshipOwner, String relationshipName)Creates PersistentObjectList initializing it with list owner persistent object and relationship name that this list maps to.
- 
Method SummaryModifier and Type Method Description voidadd(int index, E o)booleanadd(E o)booleanaddAll(int index, Collection<? extends E> c)booleanaddAll(Collection<? extends E> c)voidaddDirectly(E target)Adds an object without triggering an eventprotected booleanaddLocal(E object)voidclear()protected voidclearLocalChanges()booleancontains(Object o)booleancontainsAll(Collection c)booleanequals(Object o)Eget(int index)List<E>getValue()Returns an object stored by this ValueHolder.List<E>getValueDirectly()Retrieves ValueHolder value without triggering fault resolution.inthashCode()intindexOf(Object o)voidinvalidate()Turns itself into a fault, thus forcing a refresh on the next access.booleanisEmpty()booleanisFault()Returns whether this list is not yet resolved and requires a fetch.Iterator<E>iterator()intlastIndexOf(Object o)ListIterator<E>listIterator()ListIterator<E>listIterator(int index)protected voidmergeLocalChanges(List<E> fetchedList)protected voidpostprocessAdd(E addedObject)protected voidpostprocessAdd(Collection<? extends E> collection)protected voidpostprocessRemove(E removedObject)protected voidpostprocessRemove(Collection<? extends E> collection)Eremove(int index)booleanremove(Object o)booleanremoveAll(Collection<?> c)voidremoveDirectly(E target)Removes an object without triggering an eventprotected booleanremoveLocal(E object)protected List<E>resolvedObjectList()Returns internal objects list resolving it if needed.booleanretainAll(Collection<?> c)Eset(int index, E o)voidsetObjectList(List<E> objectList)List<E>setValue(List<E> value)Sets an object stored by this ValueHolder.List<E>setValueDirectly(List<E> value)Sets ValueHolder vaue without triggering fault resolution.protected booleanshouldAddToRemovedFromUnresolvedList(E object)intsize()List<E>subList(int fromIndex, int toIndex)Object[]toArray()<T> T[]toArray(T[] a)StringtoString()Methods inherited from class org.apache.cayenne.util.RelationshipFaultgetRelationshipName, getRelationshipOwner, isTransientParent, isUncommittedParent, resolveFromDB, updateReverseMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.CollectionparallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.ListreplaceAll, sort, spliterator
- 
Field Details- 
objectList
- 
addedToUnresolved
- 
removedFromUnresolved
 
- 
- 
Constructor Details- 
PersistentObjectListCreates PersistentObjectList initializing it with list owner persistent object and relationship name that this list maps to.- Parameters:
- relationshipOwner- persistent object that owns this list.
- relationshipName- a query used to resolve the list
 
 
- 
- 
Method Details- 
isFaultpublic boolean isFault()Returns whether this list is not yet resolved and requires a fetch.- Specified by:
- isFaultin interface- ValueHolder<E>
 
- 
invalidatepublic void invalidate()Turns itself into a fault, thus forcing a refresh on the next access.- Specified by:
- invalidatein interface- ValueHolder<E>
 
- 
setValueDirectlyDescription copied from interface:ValueHolderSets ValueHolder vaue without triggering fault resolution.- Specified by:
- setValueDirectlyin interface- ValueHolder<E>
- Throws:
- CayenneRuntimeException
 
- 
getValueDescription copied from interface:ValueHolderReturns an object stored by this ValueHolder.- Specified by:
- getValuein interface- ValueHolder<E>
- Throws:
- CayenneRuntimeException
 
- 
getValueDirectlyDescription copied from interface:ValueHolderRetrieves ValueHolder value without triggering fault resolution.- Specified by:
- getValueDirectlyin interface- ValueHolder<E>
- Throws:
- CayenneRuntimeException
 
- 
setValueDescription copied from interface:ValueHolderSets an object stored by this ValueHolder.- Specified by:
- setValuein interface- ValueHolder<E>
- Parameters:
- value- a new value of the ValueHolder.
- Returns:
- a previous value saved in the ValueHolder.
- Throws:
- CayenneRuntimeException
 
- 
setObjectList
- 
add
- 
add
- 
addAll
- 
addAll
- 
clearpublic void clear()
- 
contains
- 
containsAll- Specified by:
- containsAllin interface- Collection<E>
- Specified by:
- containsAllin interface- List<E>
 
- 
equals
- 
hashCodepublic int hashCode()
- 
get
- 
indexOf
- 
isEmptypublic boolean isEmpty()
- 
iterator
- 
lastIndexOf- Specified by:
- lastIndexOfin interface- List<E>
 
- 
listIterator- Specified by:
- listIteratorin interface- List<E>
 
- 
listIterator- Specified by:
- listIteratorin interface- List<E>
 
- 
remove
- 
remove
- 
removeAll
- 
retainAll
- 
set
- 
sizepublic int size()
- 
subList
- 
toArray
- 
toArraypublic <T> T[] toArray(T[] a)
- 
resolvedObjectListReturns internal objects list resolving it if needed.
- 
clearLocalChangesprotected void clearLocalChanges()
- 
mergeLocalChanges- Specified by:
- mergeLocalChangesin class- RelationshipFault<E>
 
- 
addLocal
- 
removeLocal
- 
shouldAddToRemovedFromUnresolvedList- Returns:
- whether object should be added to removedFromUnresolvedduring removal
 
- 
postprocessAdd
- 
postprocessRemove
- 
postprocessAdd
- 
postprocessRemove
- 
toString
- 
addDirectlyDescription copied from interface:PersistentObjectCollectionAdds an object without triggering an event- Specified by:
- addDirectlyin interface- PersistentObjectCollection<E>
 
- 
removeDirectlyDescription copied from interface:PersistentObjectCollectionRemoves an object without triggering an event- Specified by:
- removeDirectlyin interface- PersistentObjectCollection<E>
 
 
-