Java Code Examples for org.apache.tinkerpop.shaded.jackson.databind.jsontype.TypeSerializer#writeTypeSuffix()

The following examples show how to use org.apache.tinkerpop.shaded.jackson.databind.jsontype.TypeSerializer#writeTypeSuffix() . 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: HugeGraphSONModule.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeWithType(T value,
                              JsonGenerator jsonGenerator,
                              SerializerProvider provider,
                              TypeSerializer typeSer)
                              throws IOException {
    // https://github.com/FasterXML/jackson-databind/issues/2320
    WritableTypeId typeId = typeSer.typeId(value, JsonToken.VALUE_STRING);
    typeSer.writeTypePrefix(jsonGenerator, typeId);
    this.serialize(value, jsonGenerator, provider);
    typeSer.writeTypeSuffix(jsonGenerator, typeId);
}
 
Example 2
Source File: HugeGraphSONModule.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeWithType(HugeVertex value, JsonGenerator generator,
                              SerializerProvider provider,
                              TypeSerializer typeSer)
                              throws IOException {
    WritableTypeId typeId = typeSer.typeId(value, JsonToken.VALUE_STRING);
    typeSer.writeTypePrefix(generator, typeId);
    this.serialize(value, generator, provider);
    typeSer.writeTypeSuffix(generator, typeId);
}
 
Example 3
Source File: HugeGraphSONModule.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeWithType(HugeEdge value, JsonGenerator generator,
                              SerializerProvider provider,
                              TypeSerializer typeSer)
                              throws IOException {
    WritableTypeId typeId = typeSer.typeId(value, JsonToken.VALUE_STRING);
    typeSer.writeTypePrefix(generator, typeId);
    this.serialize(value, generator, provider);
    typeSer.writeTypeSuffix(generator, typeId);
}
 
Example 4
Source File: BitsyGraphSONModule.java    From bitsy with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeWithType(final UUID uuid,
                              final JsonGenerator jsonGenerator,
                              final SerializerProvider serializerProvider,
                              final TypeSerializer typeSerializer)
        throws IOException, JsonProcessingException {
    // since jackson 2.9, must keep track of `typeIdDef` in order to close it properly
    final WritableTypeId typeIdDef = typeSerializer.writeTypePrefix(jsonGenerator, typeSerializer.typeId(uuid, JsonToken.VALUE_STRING));
    String uuidStr = UUID.toString(uuid);
    jsonGenerator.writeString(uuidStr);
    typeSerializer.writeTypeSuffix(jsonGenerator, typeIdDef);
}