Package org.apache.cayenne.util
Class PersistentObjectHolder<E>
java.lang.Object
org.apache.cayenne.util.RelationshipFault<E>
org.apache.cayenne.util.PersistentObjectHolder<E>
- All Implemented Interfaces:
- Serializable,- ValueHolder<E>
public class PersistentObjectHolder<E> extends RelationshipFault<E> implements ValueHolder<E>
A ValueHolder implementation that holds a single Persistent object related to an object
 used to initialize PersistentObjectHolder. Value is resolved on first access.
- Since:
- 1.2
- See Also:
- Serialized Form
- 
Field SummaryFields inherited from class org.apache.cayenne.util.RelationshipFaultrelationshipName, relationshipOwner
- 
Constructor SummaryConstructors Constructor Description PersistentObjectHolder(Persistent relationshipOwner, String relationshipName)
- 
Method SummaryModifier and Type Method Description protected voidconnect(Persistent persistent)Returns an object that should be stored as a value in this ValueHolder, ensuring that it is registered with the same context.EgetValue()Returns a value resolving it via a query on the first call to this method.EgetValueDirectly()Retrieves ValueHolder value without triggering fault resolution.voidinvalidate()Turns a ValueHolder into a fault.booleanisFault()Returns true if this holder is not resolved, meaning its object is not yet known.protected voidmergeLocalChanges(List resolved)protected voidresolve()Reads an object from the database.EsetValue(E value)Sets an object value, marking this ValueHolder as resolved.EsetValueDirectly(E value)Sets ValueHolder vaue without triggering fault resolution.Methods inherited from class org.apache.cayenne.util.RelationshipFaultgetRelationshipName, getRelationshipOwner, isTransientParent, isUncommittedParent, resolveFromDB, updateReverse
- 
Field Details- 
faultprotected boolean fault
- 
value
 
- 
- 
Constructor Details- 
PersistentObjectHolder
 
- 
- 
Method Details- 
isFaultpublic boolean isFault()Returns true if this holder is not resolved, meaning its object is not yet known.- Specified by:
- isFaultin interface- ValueHolder<E>
 
- 
invalidatepublic void invalidate()Description copied from interface:ValueHolderTurns a ValueHolder into a fault.- Specified by:
- invalidatein interface- ValueHolder<E>
 
- 
getValueReturns a value resolving it via a query on the first call to this method.- 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
 
- 
setValueSets an object value, marking this ValueHolder as resolved.- Specified by:
- setValuein interface- ValueHolder<E>
- Parameters:
- value- a new value of the ValueHolder.
- Returns:
- a previous value saved in the ValueHolder.
- Throws:
- CayenneRuntimeException
 
- 
setValueDirectlyDescription copied from interface:ValueHolderSets ValueHolder vaue without triggering fault resolution.- Specified by:
- setValueDirectlyin interface- ValueHolder<E>
- Throws:
- CayenneRuntimeException
 
- 
connectReturns an object that should be stored as a value in this ValueHolder, ensuring that it is registered with the same context.
- 
resolveprotected void resolve()Reads an object from the database.
- 
mergeLocalChanges- Specified by:
- mergeLocalChangesin class- RelationshipFault<E>
 
 
-