本文整理汇总了Java中org.apache.tinkerpop.shaded.jackson.core.JsonParser类的典型用法代码示例。如果您正苦于以下问题:Java JsonParser类的具体用法?Java JsonParser怎么用?Java JsonParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonParser类属于org.apache.tinkerpop.shaded.jackson.core包,在下文中一共展示了JsonParser类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
@Override
public TinkerGraph deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
final Configuration conf = new BaseConfiguration();
conf.setProperty("gremlin.tinkergraph.defaultVertexPropertyCardinality", "list");
final TinkerGraph graph = TinkerGraph.open(conf);
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
if (jsonParser.getCurrentName().equals("vertices")) {
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
if (jsonParser.currentToken() == JsonToken.START_OBJECT) {
final DetachedVertex v = (DetachedVertex) deserializationContext.readValue(jsonParser, Vertex.class);
v.attach(Attachable.Method.getOrCreate(graph));
}
}
} else if (jsonParser.getCurrentName().equals("edges")) {
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
if (jsonParser.currentToken() == JsonToken.START_OBJECT) {
final DetachedEdge e = (DetachedEdge) deserializationContext.readValue(jsonParser, Edge.class);
e.attach(Attachable.Method.getOrCreate(graph));
}
}
}
}
return graph;
}
示例2: deserialize
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
public Vertex deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
final DetachedVertex.Builder v = DetachedVertex.build();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
if (jsonParser.getCurrentName().equals(GraphSONTokens.ID)) {
jsonParser.nextToken();
v.setId(deserializationContext.readValue(jsonParser, Object.class));
} else if (jsonParser.getCurrentName().equals(GraphSONTokens.LABEL)) {
jsonParser.nextToken();
v.setLabel(jsonParser.getText());
} else if (jsonParser.getCurrentName().equals(GraphSONTokens.PROPERTIES)) {
jsonParser.nextToken();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
jsonParser.nextToken();
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
v.addProperty((DetachedVertexProperty) deserializationContext.readValue(jsonParser, VertexProperty.class));
}
}
}
}
return v.create();
}
示例3: deserialize
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
@Override
public Bytecode.Binding deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
String k = null;
Object v = null;
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
if (jsonParser.getCurrentName().equals(GraphSONTokens.KEY)) {
jsonParser.nextToken();
k = jsonParser.getText();
} else if (jsonParser.getCurrentName().equals(GraphSONTokens.VALUE)) {
jsonParser.nextToken();
v = deserializationContext.readValue(jsonParser, Object.class);
}
}
return new Bytecode.Binding<>(k, v);
}
示例4: createFlattened
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
public static JsonParserConcat createFlattened(final JsonParser first, final JsonParser second) {
if (!(first instanceof JsonParserConcat) && !(second instanceof JsonParserConcat)) {
return new JsonParserConcat(new JsonParser[]{first, second});
} else {
final ArrayList p = new ArrayList();
if (first instanceof JsonParserConcat) {
((JsonParserConcat) first).addFlattenedActiveParsers(p);
} else {
p.add(first);
}
if (second instanceof JsonParserConcat) {
((JsonParserConcat) second).addFlattenedActiveParsers(p);
} else {
p.add(second);
}
return new JsonParserConcat((JsonParser[]) p.toArray(new JsonParser[p.size()]));
}
}
示例5: deserialize
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
@Override
public T deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException {
if (!jsonParser.getText().equals(GraphSONTokens.VALUE))
throw new IOException(String.format("Invalid format for %s - expecting '%s' with a text value in ISO-8061 format", _valueClass.getSimpleName(), GraphSONTokens.VALUE));
return parse(jsonParser.nextTextValue());
}
示例6: deserialize
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
@Override
public RelationIdentifier deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
if (!jsonParser.getText().equals(FIELD_RELATION_ID)) throw new IOException(String.format("Invalid serialization format for %s", RelationIdentifier.class));
final RelationIdentifier ri = RelationIdentifier.parse(jsonParser.nextTextValue());
jsonParser.nextToken();
return ri;
}
示例7: deserialize
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
Object result = super.deserialize(p, ctxt);
if (result instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, Number> map = (Map<String, Number>) result;
if (map.containsKey(CLUSTER_ID) && map.containsKey(CLUSTER_POSITION)) {
return new ORecordId(map.get(CLUSTER_ID).intValue(), map.get(CLUSTER_POSITION).longValue());
}
}
return result;
}
示例8: deserialize
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
@Override
public Map deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
final Map<Object,Object> m = new LinkedHashMap<>();
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
final Object key = deserializationContext.readValue(jsonParser, Object.class);
jsonParser.nextToken();
final Object val = deserializationContext.readValue(jsonParser, Object.class);
m.put(key, val);
}
return m;
}
示例9: deserialize
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
@Override
public T deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
jsonParser.nextToken();
// This will automatically parse all typed stuff.
final Map<String, Object> mapData = deserializationContext.readValue(jsonParser, LinkedHashMap.class);
return createObject(mapData);
}
示例10: deserializeWithType
import org.apache.tinkerpop.shaded.jackson.core.JsonParser; //导入依赖的package包/类
@Override
public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException {
return super.deserializeWithType(jp, ctxt, typeDeserializer);
}