All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.anteros.nosql.persistence.mongodb.geo.GeometryConverter Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package br.com.anteros.nosql.persistence.mongodb.geo;

import com.mongodb.DBObject;

import br.com.anteros.nosql.persistence.converters.NoSQLSimpleValueConverter;
import br.com.anteros.nosql.persistence.converters.NoSQLTypeConverter;
import br.com.anteros.nosql.persistence.metadata.NoSQLDescriptionField;


public class GeometryConverter extends NoSQLTypeConverter implements NoSQLSimpleValueConverter {
  
    public GeometryConverter() {
        super(Geometry.class);
    }

    @Override
    public Object decode(final Class targetClass, final Object fromDBObject, final NoSQLDescriptionField descriptionField) {
        DBObject dbObject = (DBObject) fromDBObject;
        String type = (String) dbObject.get("type");
        return getMapper().getConverters().decode(GeoJsonType.fromString(type).getTypeClass(), fromDBObject, descriptionField);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy