public interface DynamicProperties extends DirtyValue
DynamicProperties property on a @NodeEntity stores all its properties dynamically
on the underlying node itself.
The key/value pairs of the DynamicProperties member are stored on the node with the keys
prefixed with the property name that is returned by DelegatingFieldAccessorFactory#getNeo4jPropertyName(Field).
@NodeEntity
class Person {
String name;
DynamicProperties personalProperties = new DynamicPropertiesContainer();
}
Person p = new Person();
p.persist();
p.personalProperties.setProperty("ZIP", 8000);
p.personalProperties.setProperty("City", "Zuerich");
results in a node with the properties:
"personalProperties-ZIP" => 8000 "personalProperties-City" => "Zuerich"
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
asMap() |
DynamicProperties |
createFrom(Map<String,Object> map)
Creates a new instance with the properties set from the given map with
setPropertiesFrom(Map) |
Object |
getProperty(String key) |
Object |
getProperty(String key,
Object defaultValue) |
Iterable<String> |
getPropertyKeys()
Returns all keys
|
boolean |
hasProperty(String key) |
Object |
removeProperty(String key)
Removes the property with the given key
|
void |
setPropertiesFrom(Map<String,Object> map)
Sets a property for all key/value pairs in the given map
|
void |
setProperty(String key,
Object value)
Set the value of the property with the given key to the given value and overwrites it when such a property
already exists.
|
isDirty, setDirtyboolean hasProperty(String key)
key - the key to be checkedObject getProperty(String key)
key - key of the property to gethasProperty(java.lang.String)
returns falseObject getProperty(String key, Object defaultValue)
key - key of the property to getdefaultValue - the default value to return if no property with the given key existshasProperty(java.lang.String)
returns falsevoid setProperty(String key, Object value)
key - key of the propertyvalue - value of the propertyObject removeProperty(String key)
hasProperty(java.lang.String) returns
falsevoid setPropertiesFrom(Map<String,Object> map)
map - that contains the key/value pairs to setDynamicProperties createFrom(Map<String,Object> map)
setPropertiesFrom(Map)map - that contains the key/value pairs to setCopyright © 2011-2015–2015 Pivotal Software, Inc.. All rights reserved.