org.apache.tinkerpop.shaded.jackson.core.JsonGenerator Java Examples

The following examples show how to use org.apache.tinkerpop.shaded.jackson.core.JsonGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractGraphSONMessageSerializerV1d0.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
public void ser(final ResponseMessage responseMessage, final JsonGenerator jsonGenerator,
                final SerializerProvider serializerProvider,
                final TypeSerializer typeSerializer) throws IOException, JsonProcessingException {
    jsonGenerator.writeStartObject();
    if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());

    jsonGenerator.writeStringField(SerTokens.TOKEN_REQUEST, responseMessage.getRequestId() != null ? responseMessage.getRequestId().toString() : null);
    jsonGenerator.writeObjectFieldStart(SerTokens.TOKEN_STATUS);

    if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
    jsonGenerator.writeStringField(SerTokens.TOKEN_MESSAGE, responseMessage.getStatus().getMessage());
    jsonGenerator.writeNumberField(SerTokens.TOKEN_CODE, responseMessage.getStatus().getCode().getValue());
    jsonGenerator.writeObjectField(SerTokens.TOKEN_ATTRIBUTES, responseMessage.getStatus().getAttributes());
    jsonGenerator.writeEndObject();

    jsonGenerator.writeObjectFieldStart(SerTokens.TOKEN_RESULT);
    if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
    if (null == responseMessage.getResult().getData())
        jsonGenerator.writeNullField(SerTokens.TOKEN_DATA);
    else
        GraphSONUtil.writeWithType(SerTokens.TOKEN_DATA, responseMessage.getResult().getData(), jsonGenerator, serializerProvider, typeSerializer);
    jsonGenerator.writeObjectField(SerTokens.TOKEN_META, responseMessage.getResult().getMeta());
    jsonGenerator.writeEndObject();

    jsonGenerator.writeEndObject();
}
 
Example #2
Source File: TinkerIoRegistryV2d0.java    From tinkergraph-gremlin with Apache License 2.0 6 votes vote down vote up
@Override
public void serialize(final TinkerGraph graph, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();
    jsonGenerator.writeFieldName(GraphSONTokens.VERTICES);
    jsonGenerator.writeStartArray();

    final Iterator<Vertex> vertices = graph.vertices();
    while (vertices.hasNext()) {
        serializerProvider.defaultSerializeValue(vertices.next(), jsonGenerator);
    }

    jsonGenerator.writeEndArray();
    jsonGenerator.writeFieldName(GraphSONTokens.EDGES);
    jsonGenerator.writeStartArray();

    final Iterator<Edge> edges = graph.edges();
    while (edges.hasNext()) {
        serializerProvider.defaultSerializeValue(edges.next(), jsonGenerator);
    }

    jsonGenerator.writeEndArray();
    jsonGenerator.writeEndObject();
}
 
Example #3
Source File: GraphSONSerializersV2d0.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
private static void tryWriteMetaProperties(final VertexProperty property, final JsonGenerator jsonGenerator,
                                           final boolean normalize) throws IOException {
    // when "detached" you can't check features of the graph it detached from so it has to be
    // treated differently from a regular VertexProperty implementation.
    if (property instanceof DetachedVertexProperty) {
        // only write meta properties key if they exist
        if (property.properties().hasNext()) {
            writeMetaProperties(property, jsonGenerator, normalize);
        }
    } else {
        // still attached - so we can check the features to see if it's worth even trying to write the
        // meta properties key
        if (property.graph().features().vertex().supportsMetaProperties() && property.properties().hasNext()) {
            writeMetaProperties(property, jsonGenerator, normalize);
        }
    }
}
 
Example #4
Source File: GraphSONSerializersV3d0.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@Override
public void serialize(final TraversalExplanation traversalExplanation, final JsonGenerator jsonGenerator,
                      final SerializerProvider serializerProvider) throws IOException {
    final Map<String, Object> m = new HashMap<>();
    m.put(GraphSONTokens.ORIGINAL, getStepsAsList(traversalExplanation.getOriginalTraversal()));

    final List<Pair<TraversalStrategy, Traversal.Admin<?, ?>>> strategyTraversals = traversalExplanation.getStrategyTraversals();

    final List<Map<String, Object>> intermediates = new ArrayList<>();
    for (final Pair<TraversalStrategy, Traversal.Admin<?, ?>> pair : strategyTraversals) {
        final Map<String, Object> intermediate = new HashMap<>();
        intermediate.put(GraphSONTokens.STRATEGY, pair.getValue0().toString());
        intermediate.put(GraphSONTokens.CATEGORY, pair.getValue0().getTraversalCategory().getSimpleName());
        intermediate.put(GraphSONTokens.TRAVERSAL, getStepsAsList(pair.getValue1()));
        intermediates.add(intermediate);
    }
    m.put(GraphSONTokens.INTERMEDIATE, intermediates);

    if (strategyTraversals.isEmpty())
        m.put(GraphSONTokens.FINAL, getStepsAsList(traversalExplanation.getOriginalTraversal()));
    else
        m.put(GraphSONTokens.FINAL, getStepsAsList(strategyTraversals.get(strategyTraversals.size() - 1).getValue1()));

    jsonGenerator.writeObject(m);
}
 
Example #5
Source File: TinkerIoRegistryV3d0.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@Override
public void serialize(final TinkerGraph graph, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();
    jsonGenerator.writeFieldName(GraphSONTokens.VERTICES);
    jsonGenerator.writeStartArray();

    final Iterator<Vertex> vertices = graph.vertices();
    while (vertices.hasNext()) {
        serializerProvider.defaultSerializeValue(vertices.next(), jsonGenerator);
    }

    jsonGenerator.writeEndArray();
    jsonGenerator.writeFieldName(GraphSONTokens.EDGES);
    jsonGenerator.writeStartArray();

    final Iterator<Edge> edges = graph.edges();
    while (edges.hasNext()) {
        serializerProvider.defaultSerializeValue(edges.next(), jsonGenerator);
    }

    jsonGenerator.writeEndArray();
    jsonGenerator.writeEndObject();
}
 
Example #6
Source File: GraphSONSerializersV3d0.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
private static void tryWriteMetaProperties(final VertexProperty property, final JsonGenerator jsonGenerator,
                                           final boolean normalize) throws IOException {
    // when "detached" you can't check features of the graph it detached from so it has to be
    // treated differently from a regular VertexProperty implementation.
    if (property instanceof DetachedVertexProperty) {
        // only write meta properties key if they exist
        if (property.properties().hasNext()) {
            writeMetaProperties(property, jsonGenerator, normalize);
        }
    } else {
        // still attached - so we can check the features to see if it's worth even trying to write the
        // meta properties key
        if (property.graph().features().vertex().supportsMetaProperties() && property.properties().hasNext()) {
            writeMetaProperties(property, jsonGenerator, normalize);
        }
    }
}
 
Example #7
Source File: SchemaTable.java    From sqlg with MIT License 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void serializeWithType(final SchemaTable schemaTable, final JsonGenerator jsonGenerator,
                              final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException, JsonProcessingException {
    // when the type is included add "class" as a key and then try to utilize as much of the
    // default serialization provided by jackson data-bind as possible.  for example, write
    // the uuid as an object so that when jackson serializes it, it uses the uuid serializer
    // to write it out with the type.  in this way, data-bind should be able to deserialize
    // it back when types are embedded.
    typeSerializer.writeTypePrefixForScalar(schemaTable, jsonGenerator);
    final Map<String, Object> m = new LinkedHashMap<>();
    m.put("schema", schemaTable.getSchema());
    m.put("table", schemaTable.getTable());
    jsonGenerator.writeObject(m);
    typeSerializer.writeTypeSuffixForScalar(schemaTable, jsonGenerator);
}
 
Example #8
Source File: HugeGraphSONModule.java    From hugegraph with Apache License 2.0 6 votes vote down vote up
@Override
public void serialize(HugeEdge edge, JsonGenerator generator,
                      SerializerProvider provider)
                      throws IOException {
    edge.forceLoad();
    generator.writeStartObject();

    // Write id, label, type
    this.writeIdField("id", edge.id(), generator);
    generator.writeStringField("label", edge.label());
    generator.writeStringField("type", "edge");

    HugeVertex outVertex = (HugeVertex) edge.outVertex();
    HugeVertex inVertex = (HugeVertex) edge.inVertex();
    this.writeIdField("outV", outVertex.id(), generator);
    generator.writeStringField("outVLabel", outVertex.label());
    this.writeIdField("inV", inVertex.id(), generator);
    generator.writeStringField("inVLabel", inVertex.label());

    this.writePropertiesField(edge.getFilledProperties(),
                              generator, provider);

    generator.writeEndObject();
}
 
Example #9
Source File: GraphSONSerializersV2d0.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@Override
public void serialize(final Metrics metrics, final JsonGenerator jsonGenerator,
                      final SerializerProvider serializerProvider) throws IOException {
    final Map<String, Object> m = new HashMap<>();
    m.put(GraphSONTokens.ID, metrics.getId());
    m.put(GraphSONTokens.NAME, metrics.getName());
    m.put(GraphSONTokens.COUNTS, metrics.getCounts());
    m.put(GraphSONTokens.DURATION, metrics.getDuration(TimeUnit.NANOSECONDS) / 1000000d);

    if (!metrics.getAnnotations().isEmpty()) {
        m.put(GraphSONTokens.ANNOTATIONS, metrics.getAnnotations());
    }
    if (!metrics.getNested().isEmpty()) {
        final List<Metrics> nested = new ArrayList<>();
        metrics.getNested().forEach(it -> nested.add(it));
        m.put(GraphSONTokens.METRICS, nested);
    }
    jsonGenerator.writeObject(m);
}
 
Example #10
Source File: TraversalSerializersV3d0.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@Override
public void serialize(final P p, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();
    jsonGenerator.writeStringField(GraphSONTokens.PREDICATE,
            p instanceof ConnectiveP ?
                    p instanceof AndP ?
                            GraphSONTokens.AND :
                            GraphSONTokens.OR :
                    p.getBiPredicate().toString());
    if (p instanceof ConnectiveP) {
        jsonGenerator.writeArrayFieldStart(GraphSONTokens.VALUE);
        for (final P<?> predicate : ((ConnectiveP<?>) p).getPredicates()) {
            jsonGenerator.writeObject(predicate);
        }
        jsonGenerator.writeEndArray();
    } else
        jsonGenerator.writeObjectField(GraphSONTokens.VALUE, p.getValue());

    jsonGenerator.writeEndObject();
}
 
Example #11
Source File: GraphSONTypeSerializerV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public WritableTypeId writeTypeSuffix(final JsonGenerator jsonGenerator, final WritableTypeId writableTypeId) throws IOException {
    if (writableTypeId.valueShape == JsonToken.START_OBJECT) {
        jsonGenerator.writeEndObject();
    } else if (writableTypeId.valueShape == JsonToken.START_ARRAY) {
        jsonGenerator.writeEndArray();
    } else if (canWriteTypeId()) {
        writeTypeSuffix(jsonGenerator);
    } else {
        throw new IllegalStateException("Could not write suffix: shape[" + writableTypeId.valueShape + "] value[" + writableTypeId.forValue + "]");
    }

    return writableTypeId;
}
 
Example #12
Source File: JavaUtilSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final List list, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    for(Object o : list) {
        jsonGenerator.writeObject(o);
    }
}
 
Example #13
Source File: TraversalSerializersV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final Lambda lambda, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();
    jsonGenerator.writeStringField(GraphSONTokens.SCRIPT, lambda.getLambdaScript());
    jsonGenerator.writeStringField(GraphSONTokens.LANGUAGE, lambda.getLambdaLanguage());
    jsonGenerator.writeNumberField(GraphSONTokens.ARGUMENTS, lambda.getLambdaArguments());
    jsonGenerator.writeEndObject();
}
 
Example #14
Source File: GraphSONSerializersV1d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
private void writeProperties(final Edge edge, final JsonGenerator jsonGenerator,
                                    final SerializerProvider serializerProvider,
                                    final TypeSerializer typeSerializer) throws IOException {
    final Iterator<Property<Object>> elementProperties = normalize ?
            IteratorUtils.list(edge.properties(), Comparators.PROPERTY_COMPARATOR).iterator() : edge.properties();
    if (elementProperties.hasNext()) {
        jsonGenerator.writeObjectFieldStart(GraphSONTokens.PROPERTIES);
        if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
        while (elementProperties.hasNext()) {
            final Property<Object> elementProperty = elementProperties.next();
            GraphSONUtil.writeWithType(elementProperty.key(), elementProperty.value(), jsonGenerator, serializerProvider, typeSerializer);
        }
        jsonGenerator.writeEndObject();
    }
}
 
Example #15
Source File: GraphSONSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final TraversalMetrics traversalMetrics, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    // creation of the map enables all the fields to be properly written with their type if required
    final Map<String, Object> m = new HashMap<>();
    m.put(GraphSONTokens.DURATION, traversalMetrics.getDuration(TimeUnit.NANOSECONDS) / 1000000d);
    final List<Metrics> metrics = new ArrayList<>();
    metrics.addAll(traversalMetrics.getMetrics());
    m.put(GraphSONTokens.METRICS, metrics);

    jsonGenerator.writeObject(m);
}
 
Example #16
Source File: CustomId.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeWithType(final CustomId customId, final JsonGenerator jsonGenerator,
                              final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException, JsonProcessingException {
    // when the type is included add "class" as a key and then try to utilize as much of the
    // default serialization provided by jackson data-bind as possible.  for example, write
    // the uuid as an object so that when jackson serializes it, it uses the uuid serializer
    // to write it out with the type.  in this way, data-bind should be able to deserialize
    // it back when types are embedded.
    jsonGenerator.writeStartObject();
    jsonGenerator.writeStringField(GraphSONTokens.CLASS, CustomId.class.getName());
    jsonGenerator.writeStringField("cluster", customId.getCluster());
    jsonGenerator.writeObjectField("elementId", customId.getElementId());
    jsonGenerator.writeEndObject();
}
 
Example #17
Source File: AbstractGraphSONMessageSerializerV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
public void ser(final RequestMessage requestMessage, final JsonGenerator jsonGenerator,
                final SerializerProvider serializerProvider,
                final TypeSerializer typeSerializer) throws IOException {
    GraphSONUtil.writeStartObject(requestMessage, jsonGenerator, typeSerializer);

    jsonGenerator.writeStringField(SerTokens.TOKEN_REQUEST, requestMessage.getRequestId().toString());
    jsonGenerator.writeStringField(SerTokens.TOKEN_OP, requestMessage.getOp());
    jsonGenerator.writeStringField(SerTokens.TOKEN_PROCESSOR, requestMessage.getProcessor());
    jsonGenerator.writeObjectField(SerTokens.TOKEN_ARGS, requestMessage.getArgs());

    GraphSONUtil.writeEndObject(requestMessage, jsonGenerator, typeSerializer);
}
 
Example #18
Source File: GraphSONSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final Vertex vertex, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();

    jsonGenerator.writeObjectField(GraphSONTokens.ID, vertex.id());
    jsonGenerator.writeStringField(GraphSONTokens.LABEL, vertex.label());
    writeProperties(vertex, jsonGenerator);

    jsonGenerator.writeEndObject();

}
 
Example #19
Source File: GraphSONSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final Edge edge, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();

    jsonGenerator.writeObjectField(GraphSONTokens.ID, edge.id());
    jsonGenerator.writeStringField(GraphSONTokens.LABEL, edge.label());
    jsonGenerator.writeStringField(GraphSONTokens.IN_LABEL, edge.inVertex().label());
    jsonGenerator.writeStringField(GraphSONTokens.OUT_LABEL, edge.outVertex().label());
    jsonGenerator.writeObjectField(GraphSONTokens.IN, edge.inVertex().id());
    jsonGenerator.writeObjectField(GraphSONTokens.OUT, edge.outVertex().id());
    writeProperties(edge, jsonGenerator);

    jsonGenerator.writeEndObject();
}
 
Example #20
Source File: JavaUtilSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeWithType(final List list, final JsonGenerator jsonGenerator,
                              final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException {
    typeSerializer.writeTypePrefixForArray(list, jsonGenerator);
    serialize(list, jsonGenerator, serializerProvider);
    typeSerializer.writeTypeSuffixForArray(list, jsonGenerator);
}
 
Example #21
Source File: CustomId.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final CustomId customId, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException, JsonGenerationException {
    final Map<String, Object> m = new HashMap<>();
    m.put("cluster", customId.getCluster());
    m.put("elementId", customId.getElementId());
    jsonGenerator.writeObject(m);
}
 
Example #22
Source File: GraphSONSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
private static void writeMetaProperties(final VertexProperty property, final JsonGenerator jsonGenerator,
                                        final boolean normalize) throws IOException {
    jsonGenerator.writeFieldName(GraphSONTokens.PROPERTIES);
    jsonGenerator.writeStartObject();

    final Iterator<Property<Object>> metaProperties = normalize ?
            IteratorUtils.list((Iterator<Property<Object>>) property.properties(), Comparators.PROPERTY_COMPARATOR).iterator() : property.properties();
    while (metaProperties.hasNext()) {
        final Property<Object> metaProperty = metaProperties.next();
        jsonGenerator.writeObjectField(metaProperty.key(), metaProperty.value());
    }

    jsonGenerator.writeEndObject();
}
 
Example #23
Source File: JavaUtilSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final Map.Entry entry, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    final Map<Object,Object> m = new HashMap<>();
    if (entry != null) m.put(entry.getKey(), entry.getValue());
    jsonGenerator.writeObject(m);
}
 
Example #24
Source File: JavaUtilSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final Map map, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    for(Map.Entry entry : (Set<Map.Entry>) map.entrySet()) {
        jsonGenerator.writeObject(entry.getKey());
        jsonGenerator.writeObject(entry.getValue());
    }
}
 
Example #25
Source File: TraversalSerializersV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final TraversalStrategy traversalStrategy, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();
    for (final Map.Entry<Object, Object> entry : ConfigurationConverter.getMap(traversalStrategy.getConfiguration()).entrySet()) {
        jsonGenerator.writeObjectField((String) entry.getKey(), entry.getValue());
    }
    jsonGenerator.writeEndObject();
}
 
Example #26
Source File: JavaTimeSerializersV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeWithType(final T value, final JsonGenerator gen,
                              final SerializerProvider serializers, final TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    gen.writeString(value.toString());
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
Example #27
Source File: JavaUtilSerializersV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final Map.Entry entry, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();
    ser(entry, jsonGenerator, serializerProvider);
    jsonGenerator.writeEndObject();
}
 
Example #28
Source File: HugeResource.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(HugeResource res, JsonGenerator generator,
                      SerializerProvider provider)
                      throws IOException {
    generator.writeStartObject();

    generator.writeObjectField("type", res.type);
    generator.writeObjectField("label", res.label);
    generator.writeObjectField("properties", res.properties);

    generator.writeEndObject();
}
 
Example #29
Source File: AbstractGraphSONMessageSerializerV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final JsonBuilder json, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException, JsonGenerationException {
    // the JSON from the builder will already be started/ended as array or object...just need to surround it
    // with appropriate chars to fit into the serialization pattern.
    jsonGenerator.writeRaw(":");
    jsonGenerator.writeRaw(json.toString());
    jsonGenerator.writeRaw(",");
}
 
Example #30
Source File: TinkerIoRegistryV1d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final TinkerGraph graph, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
        throws IOException {
    jsonGenerator.writeStartObject();

    jsonGenerator.writeFieldName(GraphSONTokens.VERTICES);
    jsonGenerator.writeStartArray();

    final Iterator<Vertex> vertices = graph.vertices();
    while (vertices.hasNext()) {
        serializerProvider.defaultSerializeValue(vertices.next(), jsonGenerator);
    }

    jsonGenerator.writeEndArray();

    jsonGenerator.writeFieldName(GraphSONTokens.EDGES);
    jsonGenerator.writeStartArray();

    final Iterator<Edge> edges = graph.edges();
    while (edges.hasNext()) {
        serializerProvider.defaultSerializeValue(edges.next(), jsonGenerator);
    }

    jsonGenerator.writeEndArray();

    jsonGenerator.writeEndObject();
}