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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<E>addedToUnresolvedprotected Set<E>objectSetprotected Set<E>removedFromUnresolved-
Fields inherited from class org.apache.cayenne.util.RelationshipFault
relationshipName, relationshipOwner
-
-
Constructor Summary
Constructors Constructor Description PersistentObjectSet(Persistent relationshipOwner, String relationshipName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E o)booleanaddAll(Collection<? extends E> c)voidaddDirectly(E target)Adds an object without triggering an eventvoidclear()booleancontains(Object o)booleancontainsAll(Collection c)booleanequals(Object o)Set<E>getValue()Returns an object stored by this ValueHolder.Set<E>getValueDirectly()Retrieves ValueHolder value without triggering fault resolution.inthashCode()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()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)booleanremove(Object o)booleanremoveAll(Collection<?> c)voidremoveDirectly(E target)Removes an object without triggering an eventprotected Set<E>resolvedObjectSet()Returns internal objects list resolving it if needed.booleanretainAll(Collection<?> c)voidsetObjectSet(Set<E> objectSet)ObjectsetValue(Object value)Sets an object stored by this ValueHolder.ObjectsetValueDirectly(Object value)Sets ValueHolder vaue without triggering fault resolution.protected booleanshouldAddToRemovedFromUnresolvedSet(E object)intsize()Object[]toArray()<T> T[]toArray(T[] a)StringtoString()-
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
-
-
-
-
Constructor Detail
-
PersistentObjectSet
public PersistentObjectSet(Persistent relationshipOwner, String relationshipName)
-
-
Method Detail
-
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
public Object setValueDirectly(Object value) throws CayenneRuntimeException
Description copied from interface:ValueHolderSets ValueHolder vaue without triggering fault resolution.- Specified by:
setValueDirectlyin interfaceValueHolder<E>- Throws:
CayenneRuntimeException
-
getValue
public Set<E> getValue() throws CayenneRuntimeException
Description copied from interface:ValueHolderReturns an object stored by this ValueHolder.- Specified by:
getValuein interfaceValueHolder<E>- Throws:
CayenneRuntimeException
-
getValueDirectly
public Set<E> getValueDirectly() throws CayenneRuntimeException
Description copied from interface:ValueHolderRetrieves ValueHolder value without triggering fault resolution.- Specified by:
getValueDirectlyin interfaceValueHolder<E>- Throws:
CayenneRuntimeException
-
setValue
public Object setValue(Object value) throws CayenneRuntimeException
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
-
add
public boolean add(E o)
-
addAll
public boolean addAll(Collection<? extends E> c)
-
clear
public void clear()
-
contains
public boolean contains(Object o)
-
containsAll
public boolean containsAll(Collection c)
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
isEmpty
public boolean isEmpty()
-
remove
public boolean remove(Object o)
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
size
public int size()
-
toArray
public Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
resolvedObjectSet
protected Set<E> resolvedObjectSet()
Returns internal objects list resolving it if needed.
-
mergeLocalChanges
protected void mergeLocalChanges(List<E> resolved)
- Specified by:
mergeLocalChangesin classRelationshipFault<E>
-
postprocessAdd
protected void postprocessAdd(Collection<? extends E> collection)
-
postprocessRemove
protected void postprocessRemove(Collection<? extends E> collection)
-
postprocessAdd
protected void postprocessAdd(E addedObject)
-
postprocessRemove
protected void postprocessRemove(E removedObject)
-
shouldAddToRemovedFromUnresolvedSet
protected boolean shouldAddToRemovedFromUnresolvedSet(E object)
-
addDirectly
public void addDirectly(E target)
Description copied from interface:PersistentObjectCollectionAdds an object without triggering an event- Specified by:
addDirectlyin interfacePersistentObjectCollection<E>
-
removeDirectly
public void removeDirectly(E target)
Description copied from interface:PersistentObjectCollectionRemoves an object without triggering an event- Specified by:
removeDirectlyin interfacePersistentObjectCollection<E>
-
-