本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.VertexProperty.properties方法的典型用法代码示例。如果您正苦于以下问题:Java VertexProperty.properties方法的具体用法?Java VertexProperty.properties怎么用?Java VertexProperty.properties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.structure.VertexProperty
的用法示例。
在下文中一共展示了VertexProperty.properties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DetachedVertexProperty
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
protected DetachedVertexProperty(final VertexProperty<V> vertexProperty, final boolean withProperties) {
super(vertexProperty);
this.value = vertexProperty.value();
this.vertex = DetachedFactory.detach(vertexProperty.element(), false);
// only serialize properties if requested, the graph supports it and there are meta properties present.
// this prevents unnecessary object creation of a new HashMap which will just be empty. it will use
// Collections.emptyMap() by default
if (withProperties && vertexProperty.graph().features().vertex().supportsMetaProperties()) {
final Iterator<Property<Object>> propertyIterator = vertexProperty.properties();
if (propertyIterator.hasNext()) {
this.properties = new HashMap<>();
propertyIterator.forEachRemaining(property -> this.properties.put(property.key(), Collections.singletonList(DetachedFactory.detach(property))));
}
}
}
示例2: writeMetaProperties
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
private static void writeMetaProperties(final VertexProperty property, final JsonGenerator jsonGenerator,
final SerializerProvider serializerProvider,
final TypeSerializer typeSerializer, final boolean normalize) throws IOException {
jsonGenerator.writeObjectFieldStart(GraphSONTokens.PROPERTIES);
if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
final Iterator<Property<Object>> metaProperties = normalize ?
IteratorUtils.list(( Iterator<Property<Object>>) property.properties(), Comparators.PROPERTY_COMPARATOR).iterator() : property.properties();
while (metaProperties.hasNext()) {
final Property<Object> metaProperty = metaProperties.next();
GraphSONUtil.writeWithType(metaProperty.key(), metaProperty.value(), jsonGenerator, serializerProvider, typeSerializer);
}
jsonGenerator.writeEndObject();
}