Class ReferenceConverter
- java.lang.Object
-
- dev.morphia.converters.TypeConverter
-
- dev.morphia.converters.experimental.ReferenceConverter
-
public class ReferenceConverter extends TypeConverter
A converter for MorphiaReference values- See Also:
MorphiaReference
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 ReferenceConverter(Mapper mapper)Creates the Converter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectdecode(java.lang.Class<?> targetClass, java.lang.Object idValue, MappedField optionalExtraInfo)decode theDBObjectand provide the corresponding java (type-safe) object
NOTE: optionalExtraInfo might be nulljava.lang.Objectencode(java.lang.Object value, MappedField optionalExtraInfo)encode the (type-safe) java object into the correspondingDBObject-
Methods inherited from class dev.morphia.converters.TypeConverter
decode, encode, equals, getMapper, getSupportTypes, hashCode, isSupported, oneOf, oneOfClasses, setMapper, setSupportedTypes, setSupportTypes
-
-
-
-
Constructor Detail
-
ReferenceConverter
public ReferenceConverter(Mapper mapper)
Creates the Converter.- Parameters:
mapper- the mapper
-
-
Method Detail
-
encode
public java.lang.Object encode(java.lang.Object value, MappedField optionalExtraInfo)Description copied from class:TypeConverterencode the (type-safe) java object into the correspondingDBObject- Overrides:
encodein classTypeConverter- Parameters:
value- The object to encodeoptionalExtraInfo- the MappedField that contains the metadata useful for decoding- Returns:
- the encoded version of the object
-
decode
public java.lang.Object decode(java.lang.Class<?> targetClass, java.lang.Object idValue, MappedField optionalExtraInfo)Description copied from class:TypeConverterdecode theDBObjectand provide the corresponding java (type-safe) object
NOTE: optionalExtraInfo might be null- Specified by:
decodein classTypeConverter- Parameters:
targetClass- the class to create and populateidValue- the DBObject to use when populating the new instanceoptionalExtraInfo- the MappedField that contains the metadata useful for decoding- Returns:
- the new instance
-
-