package edu.uw.zookeeper.jackson.databind;

import java.util.List;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;

import edu.uw.zookeeper.common.Builder;

public abstract class ObjectMapperBuilder implements Builder<ObjectMapper> {

    protected ObjectMapperBuilder() {}
    
    @Override
    public ObjectMapper build() {
        ObjectMapper instance = getDefaultObjectMapper();
        for (Module module: getDefaultModules()) {
            instance.registerModule(module);
        }
        return instance;
    }
    
    protected ObjectMapper getDefaultObjectMapper() {
        return new ObjectMapper();
    }
    
    protected abstract List<Module> getDefaultModules();
}

@@ -60,16 +60,17 @@
 l.List;%0A
+%0A
 import c
@@ -158,16 +158,76 @@
 tMapper;
+%0Aimport com.fasterxml.jackson.databind.SerializationFeature;
 %0A%0Aimport
@@ -714,24 +714,131 @@
 jectMapper()
+.disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE).enable(SerializationFeature.WRITE_ENUMS_USING_INDEX)
 ;%0A    %7D%0A    

change ObjectMapper settings