Package org.apache.cayenne.util
Class PersistentObjectSet<E>
java.lang.Object
org.apache.cayenne.util.RelationshipFault<E>
org.apache.cayenne.util.PersistentObjectSet<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>,PersistentObjectCollection<E>,ValueHolder<Object>
- Direct Known Subclasses:
ToManySet
public class PersistentObjectSet<E>
extends RelationshipFault<E>
implements Set<E>, ValueHolder<Object>, PersistentObjectCollection<E>
- Since:
- 3.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.apache.cayenne.util.RelationshipFault
relationshipName, relationshipOwner -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> c) voidaddDirectly(E target) Adds an object without triggering an eventvoidclear()booleanbooleanbooleangetValue()Returns an object stored by this ValueHolder.Retrieves ValueHolder value without triggering fault resolution.inthashCode()voidTurns 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()protected voidmergeLocalChanges(List<E> resolved) protected voidpostprocessAdd(E addedObject) protected voidpostprocessAdd(Collection<? extends E> collection) protected voidpostprocessRemove(E removedObject) protected voidpostprocessRemove(Collection<? extends E> collection) booleanbooleanremoveAll(Collection<?> c) voidremoveDirectly(E target) Removes an object without triggering an eventReturns internal objects list resolving it if needed.booleanretainAll(Collection<?> c) voidsetObjectSet(Set<E> objectSet) Sets an object stored by this ValueHolder.setValueDirectly(Object value) Sets ValueHolder vaue without triggering fault resolution.protected booleanshouldAddToRemovedFromUnresolvedSet(E object) intsize()Object[]toArray()<T> T[]toArray(T[] a) toString()Methods inherited from class org.apache.cayenne.util.RelationshipFault
getRelationshipName, getRelationshipOwner, isTransientParent, isUncommittedParent, resolveFromDB, updateReverseMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Field Details
-
objectSet
-
addedToUnresolved
-
removedFromUnresolved
-
-
Constructor Details
-
PersistentObjectSet
-
-
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
-
setObjectSet
-
add
-
addAll
-
clear
public void clear() -
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>
-
equals
-
hashCode
public int hashCode() -
isEmpty
public boolean isEmpty() -
iterator
-
remove
-
removeAll
-
retainAll
-
size
public int size() -
toArray
-
toArray
public <T> T[] toArray(T[] a) -
resolvedObjectSet
Returns internal objects list resolving it if needed. -
mergeLocalChanges
- Specified by:
mergeLocalChangesin classRelationshipFault<E>
-
postprocessAdd
-
postprocessRemove
-
postprocessAdd
-
postprocessRemove
-
shouldAddToRemovedFromUnresolvedSet
-
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>
-