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 Objectdecode(BsonReader reader, DecoderContext decoderContext)Objectencode(Object value)Encodes the valuevoidencode(BsonWriter writer, Object instance, EncoderContext encoderContext)static ObjectencodeId(Mapper mapper, Object value, EntityModel model)Encodes a valueClassgetEncoderClass()static ObjectprocessId(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- the datastore to usepropertyModel- 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:PropertyHandlerEncodes the value- Specified by:
encodein 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:
getEncoderClassin interfaceEncoder<Object>
-
-