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
Modifier and TypeFieldDescriptionFields inherited from class org.apache.cayenne.util.RelationshipFault
relationshipName, relationshipOwner
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends E> c) void
addDirectly
(E target) Adds an object without triggering an eventvoid
clear()
boolean
boolean
boolean
getValue()
Returns an object stored by this ValueHolder.Retrieves ValueHolder value without triggering fault resolution.int
hashCode()
void
Turns itself into a fault, thus forcing a refresh on the next access.boolean
isEmpty()
boolean
isFault()
Returns whether this list is not yet resolved and requires a fetch.iterator()
protected void
mergeLocalChanges
(List<E> resolved) protected void
postprocessAdd
(E addedObject) protected void
postprocessAdd
(Collection<? extends E> collection) protected void
postprocessRemove
(E removedObject) protected void
postprocessRemove
(Collection<? extends E> collection) boolean
boolean
removeAll
(Collection<?> c) void
removeDirectly
(E target) Removes an object without triggering an eventReturns internal objects list resolving it if needed.boolean
retainAll
(Collection<?> c) void
setObjectSet
(Set<E> objectSet) Sets an object stored by this ValueHolder.setValueDirectly
(Object value) Sets ValueHolder vaue without triggering fault resolution.protected boolean
shouldAddToRemovedFromUnresolvedSet
(E object) int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) toString()
Methods inherited from class org.apache.cayenne.util.RelationshipFault
getRelationshipName, getRelationshipOwner, isTransientParent, isUncommittedParent, resolveFromDB, updateReverse
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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:
isFault
in interfaceValueHolder<E>
-
invalidate
public void invalidate()Turns itself into a fault, thus forcing a refresh on the next access.- Specified by:
invalidate
in interfaceValueHolder<E>
-
setValueDirectly
Description copied from interface:ValueHolder
Sets ValueHolder vaue without triggering fault resolution.- Specified by:
setValueDirectly
in interfaceValueHolder<E>
- Throws:
CayenneRuntimeException
-
getValue
Description copied from interface:ValueHolder
Returns an object stored by this ValueHolder.- Specified by:
getValue
in interfaceValueHolder<E>
- Throws:
CayenneRuntimeException
-
getValueDirectly
Description copied from interface:ValueHolder
Retrieves ValueHolder value without triggering fault resolution.- Specified by:
getValueDirectly
in interfaceValueHolder<E>
- Throws:
CayenneRuntimeException
-
setValue
Description copied from interface:ValueHolder
Sets an object stored by this ValueHolder.- Specified by:
setValue
in 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:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in 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:
mergeLocalChanges
in classRelationshipFault<E>
-
postprocessAdd
-
postprocessRemove
-
postprocessAdd
-
postprocessRemove
-
shouldAddToRemovedFromUnresolvedSet
-
toString
-
addDirectly
Description copied from interface:PersistentObjectCollection
Adds an object without triggering an event- Specified by:
addDirectly
in interfacePersistentObjectCollection<E>
-
removeDirectly
Description copied from interface:PersistentObjectCollection
Removes an object without triggering an event- Specified by:
removeDirectly
in interfacePersistentObjectCollection<E>
-