Package dev.morphia.geo
Class GeometryConverter
- java.lang.Object
-
- dev.morphia.converters.TypeConverter
-
- dev.morphia.geo.GeometryConverter
-
- All Implemented Interfaces:
SimpleValueConverter
public class GeometryConverter extends TypeConverter implements SimpleValueConverter
A Morphia TypeConverter that knows how to turn things that are labelled with the Geometry interface into the correct concrete class, based on the GeoJSON type. Only implements the decode method as the concrete classes can encode themselves without needing a converter. It's when they come out of the database that there's not enough information for Morphia to automatically create Geometry instances.
-
-
Constructor Summary
Constructors Constructor Description GeometryConverter()
Sets up this converter to work with things that implement the Geometry interface
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
decode(java.lang.Class<?> targetClass, java.lang.Object fromDBObject, MappedField optionalExtraInfo)
decode theDBObject
and provide the corresponding java (type-safe) object
NOTE: optionalExtraInfo might be null-
Methods inherited from class dev.morphia.converters.TypeConverter
decode, encode, encode, equals, getMapper, getSupportTypes, hashCode, isSupported, oneOf, oneOfClasses, setMapper, setSupportedTypes, setSupportTypes
-
-
-
-
Method Detail
-
decode
public java.lang.Object decode(java.lang.Class<?> targetClass, java.lang.Object fromDBObject, MappedField optionalExtraInfo)
Description copied from class:TypeConverter
decode theDBObject
and provide the corresponding java (type-safe) object
NOTE: optionalExtraInfo might be null- Specified by:
decode
in classTypeConverter
- Parameters:
targetClass
- the class to create and populatefromDBObject
- the DBObject to use when populating the new instanceoptionalExtraInfo
- the MappedField that contains the metadata useful for decoding- Returns:
- the new instance
-
-