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:
- 
Field SummaryFieldsFields inherited from class org.apache.cayenne.util.RelationshipFaultrelationshipName, relationshipOwner
- 
Constructor SummaryConstructorsConstructorDescriptionPersistentObjectList(Persistent relationshipOwner, String relationshipName) Creates PersistentObjectList initializing it with list owner persistent object and relationship name that this list maps to.
- 
Method SummaryModifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends E> c) booleanaddAll(Collection<? extends E> c) voidaddDirectly(E target) Adds an object without triggering an eventprotected booleanvoidclear()protected voidbooleanbooleanbooleanget(int index) getValue()Returns an object stored by this ValueHolder.Retrieves ValueHolder value without triggering fault resolution.inthashCode()intvoidTurns 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()intlistIterator(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) remove(int index) booleanbooleanremoveAll(Collection<?> c) voidremoveDirectly(E target) Removes an object without triggering an eventprotected booleanremoveLocal(E object) Returns internal objects list resolving it if needed.booleanretainAll(Collection<?> c) voidsetObjectList(List<E> objectList) Sets an object stored by this ValueHolder.setValueDirectly(List<E> value) Sets ValueHolder vaue without triggering fault resolution.protected booleanintsize()subList(int fromIndex, int toIndex) Object[]toArray()<T> T[]toArray(T[] a) toString()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>
 
 
-