Spring Data Neo4j

org.springframework.data.neo4j.fieldaccess
Class PrefixedDynamicProperties

java.lang.Object
  extended by org.springframework.data.neo4j.fieldaccess.PrefixedDynamicProperties
All Implemented Interfaces:
DynamicProperties
Direct Known Subclasses:
ManagedPrefixedDynamicProperties

public class PrefixedDynamicProperties
extends Object
implements DynamicProperties

Stores the properties internally with prefixed keys. When using the methods from DynamicProperties the prefix is dynamically added and removed so that the prefixing is not visible when using the DynamicProperties interface.

The methods *PrefixedProperty() allow to access the prefixed property key/values pairs directly.


Field Summary
protected  String prefix
           
 
Constructor Summary
PrefixedDynamicProperties(String prefix)
           
PrefixedDynamicProperties(String prefix, int initialCapacity)
           
 
Method Summary
 Map<String,Object> asMap()
           
 DynamicProperties createFrom(Map<String,Object> map)
          Creates a new instance with the properties set from the given map with DynamicProperties.setPropertiesFrom(Map)
 boolean equals(Object obj)
           
 Object getPrefixedProperty(String key)
           
 Set<String> getPrefixedPropertyKeys()
           
 Object getProperty(String key)
           
 Object getProperty(String key, Object defaultValue)
           
 Iterable<String> getPropertyKeys()
          Returns all keys
 int hashCode()
           
 boolean hasPrefixedProperty(String key)
           
 boolean hasProperty(String key)
           
 boolean isPrefixedKey(String key)
           
 Object removeProperty(String key)
          Removes the property with the given key
 void setPrefixedProperty(String key, Object value)
           
 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.
 boolean setPropertyIfPrefixed(String key, Object value)
          Set the property with the given key only if the key is prefixed.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefix

protected final String prefix
Constructor Detail

PrefixedDynamicProperties

public PrefixedDynamicProperties(String prefix)
Parameters:
prefix - the prefix to be added internally to the keys

PrefixedDynamicProperties

public PrefixedDynamicProperties(String prefix,
                                 int initialCapacity)
Parameters:
prefix - the prefix to be added internally to the keys
initialCapacity - the initialCapacity of the internal map that holds the properties
Method Detail

hasProperty

public boolean hasProperty(String key)
Specified by:
hasProperty in interface DynamicProperties
Parameters:
key - the key to be checked
Returns:
true if a property with the given key exists

getProperty

public Object getProperty(String key)
Specified by:
getProperty in interface DynamicProperties
Parameters:
key - key of the property to get
Returns:
the property with the given key, or null if no such property exists and DynamicProperties.hasProperty(java.lang.String) returns false

getProperty

public Object getProperty(String key,
                          Object defaultValue)
Specified by:
getProperty in interface DynamicProperties
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 DynamicProperties.hasProperty(java.lang.String) returns false

setProperty

public void setProperty(String key,
                        Object value)
Description copied from interface: DynamicProperties
Set the value of the property with the given key to the given value and overwrites it when such a property already exists.

Specified by:
setProperty in interface DynamicProperties
Parameters:
key - key of the property
value - value of the property

removeProperty

public Object removeProperty(String key)
Description copied from interface: DynamicProperties
Removes the property with the given key

Specified by:
removeProperty in interface DynamicProperties
Returns:
the property that has been removed or null if no such property exists and DynamicProperties.hasProperty(java.lang.String) returns false

getPropertyKeys

public Iterable<String> getPropertyKeys()
Description copied from interface: DynamicProperties
Returns all keys

Specified by:
getPropertyKeys in interface DynamicProperties
Returns:
iterable over all keys

setPropertiesFrom

public void setPropertiesFrom(Map<String,Object> map)
Description copied from interface: DynamicProperties
Sets a property for all key/value pairs in the given map

Specified by:
setPropertiesFrom in interface DynamicProperties
Parameters:
map - that contains the key/value pairs to set

createFrom

public DynamicProperties createFrom(Map<String,Object> map)
Description copied from interface: DynamicProperties
Creates a new instance with the properties set from the given map with DynamicProperties.setPropertiesFrom(Map)

Specified by:
createFrom in interface DynamicProperties
Parameters:
map - that contains the key/value pairs to set
Returns:
a new DynamicProperties instance

asMap

public Map<String,Object> asMap()
Specified by:
asMap in interface DynamicProperties
Returns:
a map with all properties key/value pairs

setPropertyIfPrefixed

public boolean setPropertyIfPrefixed(String key,
                                     Object value)
Set the property with the given key only if the key is prefixed.

Parameters:
key - key of the property
value - value
Returns:
true if the property has been set or not

isPrefixedKey

public boolean isPrefixedKey(String key)

getPrefixedProperty

public Object getPrefixedProperty(String key)

setPrefixedProperty

public void setPrefixedProperty(String key,
                                Object value)

hasPrefixedProperty

public boolean hasPrefixedProperty(String key)

getPrefixedPropertyKeys

public Set<String> getPrefixedPropertyKeys()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

Spring Data Neo4j

Copyright © 2011 SpringSource. All Rights Reserved.