private static void ser(final Map.Entry entry, final JsonGenerator jsonGenerator,
                                final SerializerProvider serializerProvider) throws IOException {
            // this treatment of keys is consistent with the current GraphSONKeySerializer which extends the
            // StdKeySerializer
            final Object key = entry.getKey();
            final Class cls = key.getClass();
            String k;
            if (cls == String.class)
                k = (String) key;
            else if (Element.class.isAssignableFrom(cls))
                k = ((Element) key).id().toString();
            else if(Date.class.isAssignableFrom(cls)) {
                if (serializerProvider.isEnabled(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS))
                    k = String.valueOf(((Date) key).getTime());
                else
                    k = serializerProvider.getConfig().getDateFormat().format((Date) key);
            } else if(cls == Class.class)
                k = ((Class) key).getName();
            else
                k = key.toString();

            serializerProvider.defaultSerializeField(k, entry.getValue(), jsonGenerator);
        }
GraphSON serializers for classes in {@code java.util.*} for the version 2.0 of GraphSON.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/JavaUtilSerializersV2.java