Class ReferenceCodec
- java.lang.Object
-
- dev.morphia.mapping.codec.PropertyCodec<Object>
-
- dev.morphia.mapping.codec.references.ReferenceCodec
-
- All Implemented Interfaces:
PropertyHandler
,org.bson.codecs.Codec<Object>
,org.bson.codecs.Decoder<Object>
,org.bson.codecs.Encoder<Object>
public class ReferenceCodec extends PropertyCodec<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, Field field, TypeData typeData)
Creates a codec
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
decode(org.bson.BsonReader reader, org.bson.codecs.DecoderContext decoderContext)
Object
encode(Object value)
Encodes the valuevoid
encode(org.bson.BsonWriter writer, Object instance, org.bson.codecs.EncoderContext encoderContext)
static Object
encodeId(Mapper mapper, Datastore datastore, Object value, EntityModel model)
Encodes a valuestatic Object
encodeId(Mapper mapper, Datastore datastore, Object value, FieldModel model)
Encodes a valueClass
getEncoderClass()
static Object
processId(Object decode, Mapper mapper, org.bson.codecs.DecoderContext decoderContext)
Decodes an ID value-
Methods inherited from class dev.morphia.mapping.codec.PropertyCodec
getDatastore, getEntityModelForField, getField, getFieldModel, getTypeData
-
-
-
-
Method Detail
-
encodeId
public static Object encodeId(Mapper mapper, Datastore datastore, Object value, FieldModel model)
Encodes a value- Parameters:
mapper
- the mapper to usedatastore
- the datastore to usevalue
- 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.
-
encodeId
public static Object encodeId(Mapper mapper, Datastore datastore, Object value, EntityModel model)
Encodes a value- Parameters:
mapper
- the mapper to usedatastore
- the datastore to usevalue
- 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
public static Object processId(Object decode, Mapper mapper, org.bson.codecs.DecoderContext decoderContext)
Decodes an ID value- Parameters:
decode
- the value to decodemapper
- the mapper to usedecoderContext
- the decoder context- Returns:
- the decoded value
-
decode
public Object decode(org.bson.BsonReader reader, org.bson.codecs.DecoderContext decoderContext)
- Specified by:
decode
in interfaceorg.bson.codecs.Decoder<Object>
-
encode
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(org.bson.BsonWriter writer, Object instance, org.bson.codecs.EncoderContext encoderContext)
- Specified by:
encode
in interfaceorg.bson.codecs.Encoder<Object>
-
-