public class PersistentObjectHolder<E> extends RelationshipFault<E> implements ValueHolder<E>
Modifier and Type | Field and Description |
---|---|
protected boolean |
fault |
protected E |
value |
relationshipName, relationshipOwner
Constructor and Description |
---|
PersistentObjectHolder(Persistent relationshipOwner,
String relationshipName) |
Modifier and Type | Method and Description |
---|---|
protected void |
connect(Persistent persistent)
Returns an object that should be stored as a value in this ValueHolder, ensuring
that it is registered with the same context.
|
E |
getValue()
Returns a value resolving it via a query on the first call to this method.
|
E |
getValueDirectly()
Retrieves ValueHolder value without triggering fault resolution.
|
void |
invalidate()
Turns a ValueHolder into a fault.
|
boolean |
isFault()
Returns true if this holder is not resolved, meaning its object is not yet known.
|
protected void |
mergeLocalChanges(List resolved) |
protected void |
resolve()
Reads an object from the database.
|
E |
setValue(E value)
Sets an object value, marking this ValueHolder as resolved.
|
E |
setValueDirectly(E value)
Sets ValueHolder vaue without triggering fault resolution.
|
getRelationshipName, getRelationshipOwner, isTransientParent, isUncommittedParent, resolveFromDB, updateReverse
protected boolean fault
protected E value
public PersistentObjectHolder(Persistent relationshipOwner, String relationshipName)
public boolean isFault()
isFault
in interface ValueHolder<E>
public void invalidate()
ValueHolder
invalidate
in interface ValueHolder<E>
public E getValue() throws CayenneRuntimeException
getValue
in interface ValueHolder<E>
CayenneRuntimeException
public E getValueDirectly() throws CayenneRuntimeException
ValueHolder
getValueDirectly
in interface ValueHolder<E>
CayenneRuntimeException
public E setValue(E value) throws CayenneRuntimeException
setValue
in interface ValueHolder<E>
value
- a new value of the ValueHolder.CayenneRuntimeException
public E setValueDirectly(E value) throws CayenneRuntimeException
ValueHolder
setValueDirectly
in interface ValueHolder<E>
CayenneRuntimeException
protected void connect(Persistent persistent)
protected void resolve()
protected void mergeLocalChanges(List resolved)
mergeLocalChanges
in class RelationshipFault<E>
Copyright © 2001–2019 Apache Cayenne. All rights reserved.