本文整理汇总了Java中org.neo4j.graphdb.PropertyContainer.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyContainer.setProperty方法的具体用法?Java PropertyContainer.setProperty怎么用?Java PropertyContainer.setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.neo4j.graphdb.PropertyContainer
的用法示例。
在下文中一共展示了PropertyContainer.setProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setProperties
import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
private static void setProperties( PropertyContainer entity, Object... properties )
{
for ( Map.Entry<String, Object> entry : MapUtil.map( properties ).entrySet() )
{
entity.setProperty( entry.getKey(), entry.getValue() );
}
}
示例2: 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);
}
}
示例3: addProperties
import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
private void addProperties(PropertyContainer entity, Map properties) {
for (Object key : properties.keySet()) {
String keyString = key.toString();
Object value = properties.get(key);
if (value instanceof List) {
List listValue = (List) value;
int listValueSize = listValue.size();
if (listValueSize >= 1) {
Object firstItem = listValue.get(0);
try {
if (firstItem instanceof Boolean) {
entity.setProperty(keyString, listValue.toArray(new Boolean[listValueSize]));
} else if (firstItem instanceof Integer) {
entity.setProperty(keyString, listValue.toArray(new Integer[listValueSize]));
} else if (firstItem instanceof Long) {
entity.setProperty(keyString, listValue.toArray(new Long[listValueSize]));
} else if (firstItem instanceof Double) {
entity.setProperty(keyString, listValue.toArray(new Double[listValueSize]));
} else if (firstItem instanceof String) {
entity.setProperty(keyString, listValue.toArray(new String[listValueSize]));
} else {
throw new ClassCastException("Cannot cast List property to a supported type");
}
} catch (ArrayStoreException ex) {
throw new ClassCastException("Cannot cast List property to a supported type");
}
} else {
entity.setProperty(keyString, new String[0]);
}
} else {
entity.setProperty(keyString, value);
}
}
}
示例4: 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);
}
}
}
示例5: assignCreated
import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
private void assignCreated(PropertyContainer container) {
container.setProperty(configuration.getCreatedProperty(), System.currentTimeMillis());
}
示例6: assignUpdated
import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
private void assignUpdated(PropertyContainer container) {
container.setProperty(configuration.getUpdatedProperty(), System.currentTimeMillis());
}
示例7: copyProperties
import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
private void copyProperties(PropertyContainer source, PropertyContainer target) {
for (String key : source.getPropertyKeys())
target.setProperty(key, source.getProperty(key));
}
示例8: addProperties
import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
public void addProperties(PropertyContainer entity, Map<String, Object> properties) {
for (String key : properties.keySet()) {
entity.setProperty(key, properties.get(key));
}
}
示例9: addProperties
import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
public void addProperties(PropertyContainer entity, Map properties) {
for (Object key : properties.keySet()) {
entity.setProperty(key.toString(), properties.get(key));
}
}
示例10: updateTimestampsFor
import org.neo4j.graphdb.PropertyContainer; //导入方法依赖的package包/类
private void updateTimestampsFor(Iterable<? extends PropertyContainer> propertyContainers, long currentTime) {
if (propertyContainers == null) return;
for (PropertyContainer propertyContainer : propertyContainers) {
propertyContainer.setProperty(MODIFIED_TIMESTAMP_PROPERTY_NAME, currentTime);
}
}