本文整理汇总了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);
}
}
示例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);
}
}
}
示例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;
}
示例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;
}