Java Code Examples for org.apache.tinkerpop.shaded.jackson.core.JsonGenerator#writeString()
The following examples show how to use
org.apache.tinkerpop.shaded.jackson.core.JsonGenerator#writeString() .
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 |
public void writeIdField(String fieldName, Id id, JsonGenerator generator) throws IOException { generator.writeFieldName(fieldName); if (id.number()) { generator.writeNumber(id.asLong()); } else { generator.writeString(id.asString()); } }
Example 2
Source File: SchemaTable.java From sqlg with MIT License | 5 votes |
@Override public void serialize(final SchemaTable schemaTable, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException { // when types are not embedded, stringify or resort to JSON primitive representations of the // type so that non-jvm languages can better interoperate with the TinkerPop stack. jsonGenerator.writeString(schemaTable.toString()); }
Example 3
Source File: SchemaTable.java From sqlg with MIT License | 5 votes |
@Override public void serialize(final SchemaTable schemaTable, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException { // when types are not embedded, stringify or resort to JSON primitive representations of the // type so that non-jvm languages can better interoperate with the TinkerPop stack. jsonGenerator.writeString(schemaTable.toString()); }
Example 4
Source File: TinkerIoRegistryV1d0.java From tinkerpop with Apache License 2.0 | 5 votes |
@Override public void serializeWithType(final TinkerGraph graph, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField(GraphSONTokens.CLASS, TinkerGraph.class.getName()); jsonGenerator.writeFieldName(GraphSONTokens.VERTICES); jsonGenerator.writeStartArray(); jsonGenerator.writeString(ArrayList.class.getName()); jsonGenerator.writeStartArray(); final Iterator<Vertex> vertices = graph.vertices(); while (vertices.hasNext()) { GraphSONUtil.writeWithType(vertices.next(), jsonGenerator, serializerProvider, typeSerializer); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndArray(); jsonGenerator.writeFieldName(GraphSONTokens.EDGES); jsonGenerator.writeStartArray(); jsonGenerator.writeString(ArrayList.class.getName()); jsonGenerator.writeStartArray(); final Iterator<Edge> edges = graph.edges(); while (edges.hasNext()) { GraphSONUtil.writeWithType(edges.next(), jsonGenerator, serializerProvider, typeSerializer); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); }
Example 5
Source File: CustomId.java From tinkerpop with Apache License 2.0 | 5 votes |
@Override public void serialize(final CustomId customId, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException { // when types are not embedded, stringify or resort to JSON primitive representations of the // type so that non-jvm languages can better interoperate with the TinkerPop stack. jsonGenerator.writeString(customId.toString()); }
Example 6
Source File: CustomId.java From tinkerpop with Apache License 2.0 | 5 votes |
@Override public void serialize(final CustomId customId, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException { // when types are not embedded, stringify or resort to JSON primitive representations of the // type so that non-jvm languages can better interoperate with the TinkerPop stack. jsonGenerator.writeString(customId.toString()); }
Example 7
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 8
Source File: GraphSONSerializersV1d0.java From tinkerpop with Apache License 2.0 | 5 votes |
private void writeProperties(final Vertex vertex, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException { jsonGenerator.writeObjectFieldStart(GraphSONTokens.PROPERTIES); if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName()); final List<String> keys = normalize ? IteratorUtils.list(vertex.keys().iterator(), Comparator.naturalOrder()) : new ArrayList<>(vertex.keys()); for (String key : keys) { final Iterator<VertexProperty<Object>> vertexProperties = normalize ? IteratorUtils.list(vertex.properties(key), Comparators.PROPERTY_COMPARATOR).iterator() : vertex.properties(key); if (vertexProperties.hasNext()) { jsonGenerator.writeArrayFieldStart(key); if (typeSerializer != null) { jsonGenerator.writeString(ArrayList.class.getName()); jsonGenerator.writeStartArray(); } while (vertexProperties.hasNext()) { serializerVertexProperty(vertexProperties.next(), jsonGenerator, serializerProvider, typeSerializer, normalize, false); } jsonGenerator.writeEndArray(); if (typeSerializer != null) jsonGenerator.writeEndArray(); } } jsonGenerator.writeEndObject(); }
Example 9
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 10
Source File: TinkerIoRegistryV1d0.java From tinkergraph-gremlin with Apache License 2.0 | 5 votes |
@Override public void serializeWithType(final TinkerGraph graph, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField(GraphSONTokens.CLASS, TinkerGraph.class.getName()); jsonGenerator.writeFieldName(GraphSONTokens.VERTICES); jsonGenerator.writeStartArray(); jsonGenerator.writeString(ArrayList.class.getName()); jsonGenerator.writeStartArray(); final Iterator<Vertex> vertices = graph.vertices(); while (vertices.hasNext()) { GraphSONUtil.writeWithType(vertices.next(), jsonGenerator, serializerProvider, typeSerializer); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndArray(); jsonGenerator.writeFieldName(GraphSONTokens.EDGES); jsonGenerator.writeStartArray(); jsonGenerator.writeString(ArrayList.class.getName()); jsonGenerator.writeStartArray(); final Iterator<Edge> edges = graph.edges(); while (edges.hasNext()) { GraphSONUtil.writeWithType(edges.next(), jsonGenerator, serializerProvider, typeSerializer); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); }
Example 11
Source File: HugeGraphSONModule.java From hugegraph with Apache License 2.0 | 5 votes |
@Override public void serialize(T value, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException { if (value.number()) { jsonGenerator.writeNumber(value.asLong()); } else { jsonGenerator.writeString(value.asString()); } }
Example 12
Source File: JavaTimeSerializersV3d0.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public void serialize(final T value, final JsonGenerator gen, final SerializerProvider serializerProvider) throws IOException { gen.writeString(value.toString()); }
Example 13
Source File: JavaTimeSerializersV2d0.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public void serialize(final T value, final JsonGenerator gen, final SerializerProvider serializerProvider) throws IOException { gen.writeString(value.toString()); }
Example 14
Source File: JavaTimeSerializersV1d0.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public void serialize(final T value, final JsonGenerator gen, final SerializerProvider serializerProvider) throws IOException { gen.writeString(value.toString()); }
Example 15
Source File: TraversalSerializersV3d0.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public void serialize(final Enum enumInstance, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeString(enumInstance.name()); }
Example 16
Source File: TraversalSerializersV2d0.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public void serialize(final Enum enumInstance, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeString(enumInstance.name()); }
Example 17
Source File: Geoshape.java From titan1withtp3.1 with Apache License 2.0 | 4 votes |
@Override public void serialize(Geoshape value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeFieldName("type"); switch(value.getType()) { case POLYGON: throw new UnsupportedOperationException("Ploygons are not supported"); case BOX: jgen.writeString("Polygon"); jgen.writeFieldName("coordinates"); jgen.writeStartArray(); jgen.writeStartArray(); jgen.writeNumber(value.coordinates[1][0]); jgen.writeNumber(value.coordinates[0][0]); jgen.writeEndArray(); jgen.writeStartArray(); jgen.writeNumber(value.coordinates[1][1]); jgen.writeNumber(value.coordinates[0][0]); jgen.writeEndArray(); jgen.writeStartArray(); jgen.writeNumber(value.coordinates[1][1]); jgen.writeNumber(value.coordinates[0][1]); jgen.writeEndArray(); jgen.writeStartArray(); jgen.writeNumber(value.coordinates[1][0]); jgen.writeNumber(value.coordinates[0][1]); jgen.writeEndArray(); jgen.writeEndArray(); break; case CIRCLE: jgen.writeString("Circle"); jgen.writeFieldName("radius"); jgen.writeNumber(value.getRadius()); jgen.writeFieldName("coordinates"); jgen.writeStartArray(); jgen.writeNumber(value.coordinates[1][0]); jgen.writeNumber(value.coordinates[0][0]); jgen.writeEndArray(); break; case POINT: jgen.writeString("Point"); jgen.writeFieldName("coordinates"); jgen.writeStartArray(); jgen.writeNumber(value.coordinates[1][0]); jgen.writeNumber(value.coordinates[0][0]); jgen.writeEndArray(); break; } jgen.writeEndObject(); }
Example 18
Source File: TitanGraphSONModule.java From titan1withtp3.1 with Apache License 2.0 | 4 votes |
@Override public void serialize(final RelationIdentifier relationIdentifier, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException { jsonGenerator.writeString(relationIdentifier.toString()); }