Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree#entrySet()

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree#entrySet() . 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: GraphSONSerializersV1d0.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
private static void ser(final Tree tree, final JsonGenerator jsonGenerator, final TypeSerializer typeSerializer)
        throws IOException {
    jsonGenerator.writeStartObject(); 
    if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
    
    Set<Map.Entry<Element, Tree>> set = tree.entrySet();
    for(Map.Entry<Element, Tree> entry : set)
    {
        jsonGenerator.writeObjectFieldStart(entry.getKey().id().toString());
        if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
        jsonGenerator.writeObjectField(GraphSONTokens.KEY, entry.getKey()); 
        jsonGenerator.writeObjectField(GraphSONTokens.VALUE, entry.getValue());
        jsonGenerator.writeEndObject();
    }
    jsonGenerator.writeEndObject();
}
 
Example 2
Source File: GraphSONSerializersV3d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final Tree tree, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException {
    jsonGenerator.writeStartArray();
    final Set<Map.Entry<Element, Tree>> set = tree.entrySet();
    for (Map.Entry<Element, Tree> entry : set) {
        jsonGenerator.writeStartObject();
        jsonGenerator.writeObjectField(GraphSONTokens.KEY, entry.getKey());
        jsonGenerator.writeObjectField(GraphSONTokens.VALUE, entry.getValue());
        jsonGenerator.writeEndObject();
    }
    jsonGenerator.writeEndArray();
}
 
Example 3
Source File: GraphSONSerializersV2d0.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(final Tree tree, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException {
    jsonGenerator.writeStartArray();
    final Set<Map.Entry<Element, Tree>> set = tree.entrySet();
    for (Map.Entry<Element, Tree> entry : set) {
        jsonGenerator.writeStartObject();
        jsonGenerator.writeObjectField(GraphSONTokens.KEY, entry.getKey());
        jsonGenerator.writeObjectField(GraphSONTokens.VALUE, entry.getValue());
        jsonGenerator.writeEndObject();
    }
    jsonGenerator.writeEndArray();
}