本文整理汇总了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;
}
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:27,代码来源:TinkerIoRegistryV3d0.java
示例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();
}
开发者ID:apache,项目名称:tinkerpop,代码行数:23,代码来源:GraphSONSerializersV3d0.java
示例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);
}
开发者ID:apache,项目名称:tinkerpop,代码行数:17,代码来源:TraversalSerializersV2d0.java
示例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()]));
}
}
开发者ID:apache,项目名称:tinkerpop,代码行数:20,代码来源:JsonParserConcat.java
示例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());
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:8,代码来源:JavaTimeSerializers.java
示例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;
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:TitanGraphSONModule.java
示例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;
}
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:13,代码来源:OrientIoRegistry.java
示例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;
}
开发者ID:apache,项目名称:tinkerpop,代码行数:14,代码来源:JavaUtilSerializersV3d0.java
示例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);
}
开发者ID:apache,项目名称:tinkerpop,代码行数:10,代码来源:AbstractObjectDeserializer.java
示例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);
}
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:5,代码来源:OrientIoRegistry.java
注:本文中的org.apache.tinkerpop.shaded.jackson.core.JsonParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论