Java Code Examples for org.apache.tinkerpop.shaded.jackson.databind.jsontype.TypeSerializer#writeTypeSuffixForScalar()
The following examples show how to use
org.apache.tinkerpop.shaded.jackson.databind.jsontype.TypeSerializer#writeTypeSuffixForScalar() .
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: RecordId.java From sqlg with MIT License | 6 votes |
@SuppressWarnings("deprecation") @Override public void serializeWithType(final RecordId recordId, 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(recordId, jsonGenerator); final Map<String, Object> m = new LinkedHashMap<>(); m.put("schemaTable", recordId.getSchemaTable()); if (recordId.hasSequenceId()) { m.put("id", recordId.sequenceId()); } else { m.put("id", recordId.getIdentifiers()); } jsonGenerator.writeObject(m); typeSerializer.writeTypeSuffixForScalar(recordId, jsonGenerator); }
Example 2
Source File: SchemaTable.java From sqlg with MIT License | 6 votes |
@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 3
Source File: JavaTimeSerializersV2d0.java From tinkerpop with Apache License 2.0 | 5 votes |
@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 4
Source File: JavaTimeSerializersV3d0.java From tinkerpop with Apache License 2.0 | 5 votes |
@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 5
Source File: CustomId.java From tinkerpop with Apache License 2.0 | 5 votes |
@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. typeSerializer.writeTypePrefixForScalar(customId, jsonGenerator); final Map<String, Object> m = new HashMap<>(); m.put("cluster", customId.getCluster()); m.put("elementId", customId.getElementId()); jsonGenerator.writeObject(m); typeSerializer.writeTypeSuffixForScalar(customId, jsonGenerator); }