org.vertexium.Element.setProperty()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(256)

本文整理了Java中org.vertexium.Element.setProperty()方法的一些代码示例,展示了Element.setProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setProperty()方法的具体详情如下:
包路径:org.vertexium.Element
类名称:Element
方法名:setProperty

Element.setProperty介绍

[英]Sets or updates a property value. The property key will be set to a constant. This is a convenience method which allows treating the multi-valued nature of properties as only containing a single value. Care must be taken when using this method because properties are not only uniquely identified by just key and name but also visibility so adding properties with the same name and different visibility strings is still permitted.
[中]设置或更新属性值。属性键将设置为常量。这是一种方便的方法,允许将属性的多值性质视为仅包含一个值。使用此方法时必须小心,因为属性不仅由键和名称唯一标识,而且由可见性唯一标识,因此仍然允许添加具有相同名称和不同可见性字符串的属性。

代码示例

代码示例来源:origin: org.visallo/visallo-core

public final void setProperty(
    Element element,
    TRaw value,
    Metadata metadata,
    Visibility visibility,
    Authorizations authorizations
) {
  element.setProperty(getPropertyName(), wrap(value), metadata, visibility, authorizations);
}

代码示例来源:origin: org.vertexium/vertexium-blueprints

@Override
public void setProperty(String propertyName, Object value) {
  if (value == null) {
    throw new IllegalArgumentException("value cannot be null.");
  }
  if (propertyName == null) {
    throw new IllegalArgumentException("Property Name cannot be null.");
  }
  if ("id".equals(propertyName)) {
    throw new IllegalArgumentException("Property Name cannot be \"id\"");
  }
  if ("".equals(propertyName)) {
    throw new IllegalArgumentException("Property Name cannot be empty.");
  }
  Visibility visibility = getGraph().getVisibilityProvider().getVisibilityForProperty(propertyName, value);
  getVertexiumElement().setProperty(propertyName, value, visibility, authorizations);
}

相关文章