Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2011 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.springframework.data.neo4j.fieldaccess;
 
 import java.util.Map;
 
A 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(java.lang.reflect.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"
 
 
 public interface DynamicProperties extends DirtyValue {

    

Parameters:
key the key to be checked
Returns:
true if a property with the given key exists
 
     boolean hasProperty(String key);

    

Parameters:
key key of the property to get
Returns:
the property with the given key, or null if no such property exists and hasProperty(java.lang.String) returns false
 
     Object getProperty(String key);

    

Parameters:
key key of the property to get
defaultValue the default value to return if no property with the given key exists
Returns:
the property with the given key or defaultValue if no such property exists and hasProperty(java.lang.String) returns false
 
     Object getProperty(String keyObject defaultValue);

    
Set the value of the property with the given key to the given value and overwrites it when such a property already exists.

Parameters:
key key of the property
value value of the property
 
     void setProperty(String keyObject value);

    
Removes the property with the given key

Returns:
the property that has been removed or null if no such property exists and hasProperty(java.lang.String) returns false
 
     Object removeProperty(String key);

    
Returns all keys

Returns:
iterable over all keys
 
     Iterable<StringgetPropertyKeys();

    

Returns:
a map with all properties key/value pairs
    Map<StringObjectasMap();

    
Sets a property for all key/value pairs in the given map

Parameters:
map that contains the key/value pairs to set
    void setPropertiesFrom(Map<StringObjectmap);

    
Creates a new instance with the properties set from the given map with setPropertiesFrom(java.util.Map)

Parameters:
map that contains the key/value pairs to set
Returns:
a new DynamicProperties instance
New to GrepCode? Check out our FAQ X