// Path: stardao-mongodb/src/main/java/io/stardog/stardao/mongodb/mapper/jackson/ObjectIdDeserializer.java
// public class ObjectIdDeserializer extends JsonDeserializer<ObjectId> {
//     @Override
//     public ObjectId deserialize(JsonParser parser, DeserializationContext ctx) throws IOException {
//         String id = parser.getValueAsString();
//         if ("".equals(id)) {
//             return null;
//         }
//         return new ObjectId(id);
//     }
// }


import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.stardog.stardao.mongodb.mapper.jackson.ObjectIdDeserializer;
import org.bson.types.Decimal128;
import org.bson.types.ObjectId;
package io.stardog.stardao.mongodb.mapper.jackson.modules;


/**
 * A Jackson module that handles serializing special types that we might get back from MongoDB,
 * for lossless conversion to POJOs.
 */
public class MongoModule extends SimpleModule {
    public MongoModule() {
        super();
        addSerializer(Decimal128.class, new ToStringSerializer());
        addSerializer(ObjectId.class, new ToStringSerializer());
// Path: stardao-mongodb/src/main/java/io/stardog/stardao/mongodb/mapper/jackson/ObjectIdDeserializer.java
// public class ObjectIdDeserializer extends JsonDeserializer<ObjectId> {
//     @Override
//     public ObjectId deserialize(JsonParser parser, DeserializationContext ctx) throws IOException {
//         String id = parser.getValueAsString();
//         if ("".equals(id)) {
//             return null;
//         }
//         return new ObjectId(id);
//     }
// }


// Path: stardao-mongodb/src/main/java/io/stardog/stardao/mongodb/mapper/jackson/modules/MongoModule.java
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.stardog.stardao.mongodb.mapper.jackson.ObjectIdDeserializer;
import org.bson.types.Decimal128;
import org.bson.types.ObjectId;

package io.stardog.stardao.mongodb.mapper.jackson.modules;


/**
 * A Jackson module that handles serializing special types that we might get back from MongoDB,
 * for lossless conversion to POJOs.
 */
public class MongoModule extends SimpleModule {
    public MongoModule() {
        super();
        addSerializer(Decimal128.class, new ToStringSerializer());
        addSerializer(ObjectId.class, new ToStringSerializer());
        addDeserializer(ObjectId.class, new ObjectIdDeserializer());