当前位置: 首页>>代码示例>>Java>>正文


Java Element.property方法代码示例

本文整理汇总了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;
}
 
开发者ID:karthicks,项目名称:gremlin-ogm,代码行数:13,代码来源:UpdateBy.java

示例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]);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:ElementHelper.java

示例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);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:37,代码来源:AddPropertyStep.java


注:本文中的org.apache.tinkerpop.gremlin.structure.Element.property方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。