Package dev.morphia.mapping.experimental
Class MorphiaReference<T>
- java.lang.Object
-
- dev.morphia.mapping.experimental.MorphiaReference<T>
-
- Type Parameters:
T
-
- Direct Known Subclasses:
CollectionReference
,MapReference
,SingleReference
@Handler(MorphiaReferenceCodec.class) public abstract class MorphiaReference<T> extends Object
Wrapper type for references to entities in other collections- Since:
- 1.5
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
abstract T
get()
abstract List<Object>
getIds()
abstract Class<T>
getType()
int
hashCode()
boolean
ignoreMissing()
MorphiaReference<T>
ignoreMissing(boolean ignoreMissing)
Instructs Morphia to ignore missing referenced entities.boolean
isResolved()
protected void
resolve()
String
toString()
static <V> MorphiaReference<V>
wrap(V value)
Wraps an value in a MorphiaReference to storing on an entity
-
-
-
Method Detail
-
wrap
public static <V> MorphiaReference<V> wrap(V value)
Wraps an value in a MorphiaReference to storing on an entity- Type Parameters:
V
- the type of the value- Parameters:
value
- the value wrap- Returns:
- the MorphiaReference wrapper
-
get
@Nullable public abstract T get()
- Returns:
- returns the referenced entity if it exists. May return null.
-
ignoreMissing
public MorphiaReference<T> ignoreMissing(boolean ignoreMissing)
Instructs Morphia to ignore missing referenced entities. The default is to throw an exception on missing entities.- Parameters:
ignoreMissing
- ignore any missing referenced documents- Returns:
- this
-
ignoreMissing
public boolean ignoreMissing()
- Returns:
- true if Morphia will ignore missing referenced entities.
-
isResolved
public final boolean isResolved()
- Returns:
- true if this reference has already been resolved
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
resolve
protected void resolve()
-
-