本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.Element.property方法的典型用法代码示例。如果您正苦于以下问题:Java Element.property方法的具体用法?Java Element.property怎么用?Java Element.property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.structure.Element
的用法示例。
在下文中一共展示了Element.property方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: property
import org.apache.tinkerpop.gremlin.structure.Element; //导入方法依赖的package包/类
@Override
public Element property(Element element, Update update) {
if (update.getKeyValues() != null) {
((Vertex) element).property(update.getCardinality(),
update.getKey(),
update.getValue(),
update.getKeyValues());
} else {
element.property(update.getKey(), update.getValue());
}
return element;
}
示例2: attachProperties
import org.apache.tinkerpop.gremlin.structure.Element; //导入方法依赖的package包/类
/**
* Assign key/value pairs as properties to an {@link org.apache.tinkerpop.gremlin.structure.Element}. If the value of {@link T#id} or
* {@link T#label} is in the set of pairs, then they are ignored.
*
* @param element the graph element to assign the {@code propertyKeyValues}
* @param propertyKeyValues the key/value pairs to assign to the {@code element}
* @throws ClassCastException if the value of the key is not a {@link String}
* @throws IllegalArgumentException if the value of {@code element} is null
*/
public static void attachProperties(final Element element, final Object... propertyKeyValues) {
if (null == element)
throw Graph.Exceptions.argumentCanNotBeNull("element");
for (int i = 0; i < propertyKeyValues.length; i = i + 2) {
if (!propertyKeyValues[i].equals(T.id) && !propertyKeyValues[i].equals(T.label))
element.property((String) propertyKeyValues[i], propertyKeyValues[i + 1]);
}
}
示例3: sideEffect
import org.apache.tinkerpop.gremlin.structure.Element; //导入方法依赖的package包/类
@Override
protected void sideEffect(final Traverser.Admin<S> traverser) {
final String key = (String) this.parameters.get(traverser, T.key, () -> {
throw new IllegalStateException("The AddPropertyStep does not have a provided key: " + this);
}).get(0);
final Object value = this.parameters.get(traverser, T.value, () -> {
throw new IllegalStateException("The AddPropertyStep does not have a provided value: " + this);
}).get(0);
final Object[] vertexPropertyKeyValues = this.parameters.getKeyValues(traverser, T.key, T.value);
final Element element = traverser.get();
if (this.callbackRegistry != null) {
final Property currentProperty = traverser.get().property(key);
final boolean newProperty = element instanceof Vertex ? currentProperty == VertexProperty.empty() : currentProperty == Property.empty();
final Event.ElementPropertyChangedEvent evt;
if (element instanceof Vertex)
evt = new Event.VertexPropertyChangedEvent(DetachedFactory.detach((Vertex) element, true), newProperty ? null : DetachedFactory.detach((VertexProperty) currentProperty, true), value, vertexPropertyKeyValues);
else if (element instanceof Edge)
evt = new Event.EdgePropertyChangedEvent(DetachedFactory.detach((Edge) element, true), newProperty ? null : DetachedFactory.detach(currentProperty), value);
else if (element instanceof VertexProperty)
evt = new Event.VertexPropertyPropertyChangedEvent(DetachedFactory.detach((VertexProperty) element, true), newProperty ? null : DetachedFactory.detach(currentProperty), value);
else
throw new IllegalStateException(String.format("The incoming object cannot be processed by change eventing in %s: %s", AddPropertyStep.class.getName(), element));
this.callbackRegistry.getCallbacks().forEach(c -> c.accept(evt));
}
if (null != this.cardinality)
((Vertex) element).property(this.cardinality, key, value, vertexPropertyKeyValues);
else if (vertexPropertyKeyValues.length > 0)
((Vertex) element).property(key, value, vertexPropertyKeyValues);
else
element.property(key, value);
}