package com.tinkerpop.gremlin.structure.io.graphson;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;

import java.util.Optional;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class GraphSONObjectMapper extends ObjectMapper {
    public GraphSONObjectMapper() {
        this(null);
    }

    public GraphSONObjectMapper(final SimpleModule custom) {
        disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

        // this provider toStrings all unknown classes and converts keys in Map objects that are Object to String.
        final DefaultSerializerProvider provider = new GraphSONSerializerProvider();
        provider.setDefaultKeySerializer(new GraphSONModule.GraphSONKeySerializer());
        setSerializerProvider(provider);

        registerModule(new GraphSONModule());
        Optional.ofNullable(custom).ifPresent(this::registerModule);

        // plugin external serialization modules
        findAndRegisterModules();
    }
}

@@ -493,16 +493,23 @@
 his(null
+, false
 );%0A    %7D
@@ -567,24 +567,156 @@
 e custom) %7B%0A
+        this(custom, false);%0A    %7D%0A%0A    public GraphSONObjectMapper(final SimpleModule custom, final boolean loadExternalModules) %7B%0A
         disa
@@ -1256,16 +1256,53 @@
 modules%0A
+        if (loadExternalModules)%0A    
         

Configure dynamic serializer loader for GraphSON