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

com.capitalone.dashboard.mapper.ObjectIdSerializer Maven / Gradle / Ivy

There is a newer version: 3.7.33
Show newest version
package com.capitalone.dashboard.mapper;


import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.bson.types.ObjectId;

import java.io.IOException;


/**
 * Serialize Mongo ObjectId's as Strings.
 */
public class ObjectIdSerializer extends JsonSerializer {

    @Override
    public void serialize(ObjectId value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
        gen.writeString(value.toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy