Class ReferenceCodec
- java.lang.Object
-
- dev.morphia.mapping.codec.BaseReferenceCodec<Object>
-
- dev.morphia.mapping.codec.references.ReferenceCodec
-
@MorphiaInternal public class ReferenceCodec extends BaseReferenceCodec<Object> implements PropertyHandler
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 ReferenceCodec(Datastore datastore, PropertyModel propertyModel)
Creates a codec
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
decode(BsonReader reader, DecoderContext decoderContext)
Object
encode(Object value)
Encodes the valuevoid
encode(BsonWriter writer, Object instance, EncoderContext encoderContext)
static Object
encodeId(Mapper mapper, Object value, EntityModel model)
Encodes a valueClass
getEncoderClass()
static Object
processId(Datastore datastore, Object decode, DecoderContext decoderContext)
Decodes an ID value-
Methods inherited from class dev.morphia.mapping.codec.BaseReferenceCodec
getDatastore, getEntityModelForField, getPropertyModel, getReferenceAnnotation, getTypeData
-
-
-
-
Constructor Detail
-
ReferenceCodec
public ReferenceCodec(Datastore datastore, PropertyModel propertyModel)
Creates a codec- Parameters:
datastore
-propertyModel
- the reference property
-
-
Method Detail
-
encodeId
@Nullable @MorphiaInternal public static Object encodeId(Mapper mapper, Object value, EntityModel model)
Encodes a value- Parameters:
mapper
-value
- the value to encodemodel
- the mapped class of the field type- Returns:
- the encoded value
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
processId
@NonNull public static Object processId(Datastore datastore, Object decode, DecoderContext decoderContext)
Decodes an ID value- Parameters:
datastore
- the Datastore to usedecode
- the value to decodedecoderContext
- the decoder context- Returns:
- the decoded value
-
decode
@Nullable public Object decode(BsonReader reader, DecoderContext decoderContext)
-
encode
@Nullable public Object encode(Object value)
Description copied from interface:PropertyHandler
Encodes the value- Specified by:
encode
in interfacePropertyHandler
- Parameters:
value
- the value- Returns:
- the encoded value
-
encode
public void encode(BsonWriter writer, Object instance, EncoderContext encoderContext)
-
getEncoderClass
public Class getEncoderClass()
- Specified by:
getEncoderClass
in interfaceEncoder<Object>
-
-