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>, SequencedCollection<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 Summary
FieldsFields inherited from class RelationshipFault
relationshipName, relationshipOwner -
Constructor Summary
ConstructorsConstructorDescriptionPersistentObjectList(Persistent relationshipOwner, String relationshipName) Creates PersistentObjectList initializing it with list owner persistent object and relationship name that this list maps to. -
Method Summary
Modifier 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 RelationshipFault
getRelationshipName, getRelationshipOwner, isTransientParent, isUncommittedParent, resolveFromDB, updateReverseMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Field Details
-
objectList
-
addedToUnresolved
-
removedFromUnresolved
-
-
Constructor Details
-
PersistentObjectList
Creates 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
-
isFault
public boolean isFault()Returns whether this list is not yet resolved and requires a fetch.- Specified by:
isFaultin interfaceValueHolder<E>
-
invalidate
public void invalidate()Turns itself into a fault, thus forcing a refresh on the next access.- Specified by:
invalidatein interfaceValueHolder<E>
-
setValueDirectly
Description copied from interface:ValueHolderSets ValueHolder vaue without triggering fault resolution.- Specified by:
setValueDirectlyin interfaceValueHolder<E>- Throws:
CayenneRuntimeException
-
getValue
Description copied from interface:ValueHolderReturns an object stored by this ValueHolder.- Specified by:
getValuein interfaceValueHolder<E>- Throws:
CayenneRuntimeException
-
getValueDirectly
Description copied from interface:ValueHolderRetrieves ValueHolder value without triggering fault resolution.- Specified by:
getValueDirectlyin interfaceValueHolder<E>- Throws:
CayenneRuntimeException
-
setValue
Description copied from interface:ValueHolderSets an object stored by this ValueHolder.- Specified by:
setValuein interfaceValueHolder<E>- Parameters:
value- a new value of the ValueHolder.- Returns:
- a previous value saved in the ValueHolder.
- Throws:
CayenneRuntimeException
-
setObjectList
-
add
-
add
-
addAll
-
addAll
-
clear
-
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
equals
-
hashCode
-
get
-
indexOf
-
isEmpty
-
iterator
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
remove
-
remove
-
removeAll
-
retainAll
-
set
-
size
-
subList
-
toArray
-
toArray
-
resolvedObjectList
-
clearLocalChanges
protected void clearLocalChanges() -
mergeLocalChanges
- Specified by:
mergeLocalChangesin classRelationshipFault<E>
-
addLocal
-
removeLocal
-
shouldAddToRemovedFromUnresolvedList
- Returns:
- whether object should be added to
removedFromUnresolvedduring removal
-
postprocessAdd
-
postprocessRemove
-
postprocessAdd
-
postprocessRemove
-
toString
-
addDirectly
Description copied from interface:PersistentObjectCollectionAdds an object without triggering an event- Specified by:
addDirectlyin interfacePersistentObjectCollection<E>
-
removeDirectly
Description copied from interface:PersistentObjectCollectionRemoves an object without triggering an event- Specified by:
removeDirectlyin interfacePersistentObjectCollection<E>
-