Package dev.morphia.mapping.experimental
Class SingleReference<T>
- java.lang.Object
-
- dev.morphia.mapping.experimental.MorphiaReference<T>
-
- dev.morphia.mapping.experimental.SingleReference<T>
-
- Type Parameters:
T
-
public class SingleReference<T> extends MorphiaReference<T>
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Constructor Summary
Constructors Constructor Description SingleReference(Datastore datastore, EntityModel entityModel, Object id)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MorphiaReference<?>
decode(Datastore datastore, Mapper mapper, PropertyModel mappedField, Class<?> paramType, org.bson.Document document)
Decodes a document in to an entityT
get()
List<Object>
getIds()
Class<T>
getType()
-
Methods inherited from class dev.morphia.mapping.experimental.MorphiaReference
equals, hashCode, ignoreMissing, ignoreMissing, isResolved, resolve, toString, wrap
-
-
-
-
Constructor Detail
-
SingleReference
public SingleReference(Datastore datastore, EntityModel entityModel, Object id)
- Parameters:
datastore
- the datastore to useentityModel
- the entity's mapped classid
- the ID value
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Method Detail
-
decode
public static MorphiaReference<?> decode(Datastore datastore, Mapper mapper, PropertyModel mappedField, Class<?> paramType, org.bson.Document document)
Decodes a document in to an entity- Parameters:
datastore
- the datastoremapper
- the mappermappedField
- the MappedFieldparamType
- the type of the underlying entitydocument
- the Document to decode- Returns:
- the entity
-
get
public T get()
- Specified by:
get
in classMorphiaReference<T>
- Returns:
- returns the referenced entity if it exists. May return null.
-
getIds
public List<Object> getIds()
- Specified by:
getIds
in classMorphiaReference<T>
- Returns:
- the referenced IDs
-
getType
public Class<T> getType()
- Specified by:
getType
in classMorphiaReference<T>
- Returns:
- the referenced type
-
-