本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex.build方法的典型用法代码示例。如果您正苦于以下问题:Java DetachedVertex.build方法的具体用法?Java DetachedVertex.build怎么用?Java DetachedVertex.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex
的用法示例。
在下文中一共展示了DetachedVertex.build方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex; //导入方法依赖的package包/类
@Override
public <I extends InputShim> Edge read(final KryoShim<I, ?> kryo, final I input, final Class<Edge> edgeClass) {
final DetachedEdge.Builder builder = DetachedEdge.build();
builder.setId(kryo.readClassAndObject(input));
builder.setLabel(input.readString());
final DetachedVertex.Builder inV = DetachedVertex.build();
inV.setId(kryo.readClassAndObject(input));
inV.setLabel(input.readString());
builder.setInV(inV.create());
final DetachedVertex.Builder outV = DetachedVertex.build();
outV.setId(kryo.readClassAndObject(input));
outV.setLabel(input.readString());
builder.setOutV(outV.create());
while(input.readBoolean()) {
builder.addProperty(new DetachedProperty<>(input.readString(), kryo.readClassAndObject(input)));
}
return builder.create();
}
示例2: deserialize
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex; //导入方法依赖的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();
}