Search in sources :

Example 1 with UUIDSerializer

use of com.fasterxml.jackson.databind.ser.std.UUIDSerializer in project bson4jackson by michel-kraemer.

the class BsonUuidSerializer method serialize.

@Override
public void serialize(UUID value, JsonGenerator gen, SerializerProvider provider) throws IOException {
    if (gen instanceof BsonGenerator) {
        BsonGenerator bgen = (BsonGenerator) gen;
        bgen.writeBinary(null, BsonConstants.SUBTYPE_UUID, uuidToLittleEndianBytes(value), 0, 16);
    } else {
        new UUIDSerializer().serialize(value, gen, provider);
    }
}
Also used : UUIDSerializer(com.fasterxml.jackson.databind.ser.std.UUIDSerializer) BsonGenerator(de.undercouch.bson4jackson.BsonGenerator)

Aggregations

UUIDSerializer (com.fasterxml.jackson.databind.ser.std.UUIDSerializer)1 BsonGenerator (de.undercouch.bson4jackson.BsonGenerator)1