Package dev.morphia.mapping.experimental
Class MorphiaReferenceCodec
- java.lang.Object
-
- dev.morphia.mapping.codec.BaseReferenceCodec<MorphiaReference>
-
- dev.morphia.mapping.experimental.MorphiaReferenceCodec
-
- All Implemented Interfaces:
PropertyHandler
,org.bson.codecs.Codec<MorphiaReference>
,org.bson.codecs.Decoder<MorphiaReference>
,org.bson.codecs.Encoder<MorphiaReference>
public class MorphiaReferenceCodec extends BaseReferenceCodec<MorphiaReference> implements PropertyHandler
Defines a codec for MorphiaReference values
-
-
Constructor Summary
Constructors Constructor Description MorphiaReferenceCodec(Datastore datastore, PropertyModel propertyModel)
Creates a codec
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MorphiaReference
decode(org.bson.BsonReader reader, org.bson.codecs.DecoderContext decoderContext)
Object
encode(Object value)
Encodes the valuevoid
encode(org.bson.BsonWriter writer, MorphiaReference value, org.bson.codecs.EncoderContext encoderContext)
Class
getEncoderClass()
-
Methods inherited from class dev.morphia.mapping.codec.BaseReferenceCodec
getDatastore, getEntityModelForField, getPropertyModel, getReferenceAnnotation, getTypeData
-
-
-
-
Constructor Detail
-
MorphiaReferenceCodec
public MorphiaReferenceCodec(Datastore datastore, PropertyModel propertyModel)
Creates a codec- Parameters:
datastore
- the datastorepropertyModel
- the reference property model
-
-
Method Detail
-
decode
public MorphiaReference decode(org.bson.BsonReader reader, org.bson.codecs.DecoderContext decoderContext)
- Specified by:
decode
in interfaceorg.bson.codecs.Decoder<MorphiaReference>
-
encode
public Object encode(@Nullable 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(org.bson.BsonWriter writer, MorphiaReference value, org.bson.codecs.EncoderContext encoderContext)
- Specified by:
encode
in interfaceorg.bson.codecs.Encoder<MorphiaReference>
-
getEncoderClass
public Class getEncoderClass()
- Specified by:
getEncoderClass
in interfaceorg.bson.codecs.Encoder<MorphiaReference>
-
-