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


Java PropertyContainer.hasProperty方法代码示例

本文整理汇总了Java中org.neo4j.graphdb.PropertyContainer.hasProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyContainer.hasProperty方法的具体用法?Java PropertyContainer.hasProperty怎么用?Java PropertyContainer.hasProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.neo4j.graphdb.PropertyContainer的用法示例。


在下文中一共展示了PropertyContainer.hasProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addProperty

import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
/***
 * Add a property value to a container.
 * 
 * Abstracts dealing with underlying value arrays. The property may already have a value.
 * 
 * @param container the {@link PropertyContainer} in question
 * @param property the name of the property to append
 * @param value the value to append
 */
public static void addProperty(PropertyContainer container, String property, Object value) {
  if (container.hasProperty(property)) {
    Object origValue = container.getProperty(property);
    Object newValue = getNewPropertyValue(origValue, value);
    container.setProperty(property, newValue);
  } else {
    container.setProperty(property, value);
  }
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:19,代码来源:GraphUtil.java

示例2: addCreatedTimestampFor

import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
private void addCreatedTimestampFor(Iterable<? extends PropertyContainer> propertyContainers, long currentTime) {
  if (propertyContainers == null) return;
  for (PropertyContainer propertyContainer : propertyContainers) {
    if (!propertyContainer.hasProperty(CREATED_TIMESTAMP_PROPERTY_NAME)){
      propertyContainer.setProperty(CREATED_TIMESTAMP_PROPERTY_NAME, currentTime);
    }
  }
}
 
开发者ID:ttiurani,项目名称:neo4j-timestamp,代码行数:9,代码来源:TimestampTransactionEventHandler.java

示例3: getProperty

import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
/***
 * Get a single valued property in a type-safe way.
 * 
 * @param container the {@link PropertyContainer} in question
 * @param property the name of the property
 * @param type the expected type of the property
 * @return an {@link Optional} property value
 * @throws ClassCastException if {@code type} does not match the actual type in the graph
 */
static public <T> Optional<T> getProperty(PropertyContainer container, String property,
    Class<T> type) {
  Optional<T> value = Optional.<T>empty();
  if (container.hasProperty(property)) {
    value = Optional.<T> of(type.cast(container.getProperty(property)));
  }
  return value;
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:18,代码来源:GraphUtil.java

示例4: getProperties

import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
/***
 * Get multi-valued properties.
 * 
 * @param container the {@link PropertyContainer} in question
 * @param property the name of the property
 * @param type the expected type of the property
 * @return collection of property values (empty if the property does not exist). 
 * @throws ClassCastException if the {@code type} does not match the actual type in the graph
 */
static public <T> Collection<T> getProperties(PropertyContainer container, String property,
    Class<T> type) {
  List<T> list = new ArrayList<>();
  if (container.hasProperty(property)) {
    return getPropertiesAsSet(container.getProperty(property), type);
  }
  return list;
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:18,代码来源:GraphUtil.java


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