@Override
    public Kryo registerWith(final Kryo kryo) {
        if (null != functionOfShadedKryo)
            kryo.register(clazz, functionOfShadedKryo.apply(kryo), id);
        else if (null != shadedSerializer)
            kryo.register(clazz, shadedSerializer, id);
        else if (null != serializerShim)
            kryo.register(clazz, new ShadedSerializerAdapter<>(serializerShim), id);
        else {
            kryo.register(clazz, kryo.getDefaultSerializer(clazz), id);
            // Suprisingly, the preceding call is not equivalent to
            //   kryo.register(clazz, id);
        }

        return kryo;
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoTypeReg.java