This class allows the creation of a hierarchical tree of named
PropertyValue instances.
When a property is looked up in a child
HierarchicalProperties instance, the lookup will be propagated
to its parent when it couldn't be found in the child. A single hierarchical
line is thus considered to be one collection that groups all involved
HierarchicalProperties instances. Retrieving the names and the
size will recursively take all the properties of the parents into account
and return the consolidated result. To offer these features, intelligent
caching has been implemented to ensure optimal performance.
author: Geert Bevin (gbevin[remove] at uwyn dot com) version: $Revision: 3643 $ since: 1.1
getValueString(String name, String defaultValue) Retrieves the string value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy.
public T
getValueTyped(String name, Class<T> type) Retrieves the typed value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy.
public T
getValueTyped(String name, Class<T> type, T defaultValue) Retrieves the typed value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy.
putAll(HierarchicalProperties source) Copies all of the named properties from the specified
HierarchicalProperties instance to this
HierarchicalProperties instance.
Checks the HierarchicalProperties hierarchy for the
presence of the specified name.
Parameters: name - the name whose presence will be checked true if the name was found; or
Creates a copy of this HierarchicalProperties hierarchy
until a certain instance is reached.
Each copied instance will shared the datastructure in which the
properties are stored with the original. Creating a shadow is this for
changing the hierarchical structure but maintaining a centralized
management of the properties.
Parameters: limit - the HierarchicalProperties instance that willnot be part of the shadow copy and interrupt the copying process; ornull if the entire hierachy should be copied. the shadow copy of this HierarchicalPropertieshierarchyhierarchy since: 1.1
Retrieves the PropertyValue for a specific name from the
HierarchicalProperties hierarchy.
Parameters: name - the name whose associated value will be returned the associated PropertyValue; or
Retrieves a Set with the unique names that are present in
the HierarchicalProperties hierarchy and that conform to
the Java
rules for valid identifiers. The names in this set are thus usable
for injection through bean setters.
a Set with the unique injectable names See Also:HierarchicalProperties.getNames since: 1.1
Retrieves the Map with only the properties that are
locally present in this HierarchicalProperties instance.
the local Map of thisHierarchicalProperties instance since: 1.1
Retrieves a Set with the unique names that are present in
the HierarchicalProperties hierarchy.
a collection with the unique names See Also:HierarchicalProperties.getInjectableNames since: 1.1
Retrieves the value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy.
Parameters: name - the name whose associated value will be returned the associated PropertyValue; or
Retrieves the value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy. If the property couldn't
be found or if the value was null, the default value will be
returned.
Parameters: name - the name whose associated value will be returned Parameters: defaultValue - the value that should be used as a fallback the associated PropertyValue; or
Retrieves the string value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy.
Parameters: name - the name whose associated value will be returned the string value of the retrieved PropertyValue; or
Retrieves the string value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy. If the property couldn't
be found, if the value was null or if the value was empty, the
default value will be returned.
Parameters: name - the name whose associated value will be returned Parameters: defaultValue - the value that should be used as a fallback the string value of the retrieved PropertyValue; or
Retrieves the typed value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy.
Note that no conversion will occurr, the value is simple verified to be
assignable to the requested type and then casted to it.
Parameters: name - the name whose associated value will be returned Parameters: type - the class that the value has to be retrieved as the associated PropertyValue as an instance of theprovided type; or
Retrieves the typed value of PropertyValue for a specific name from
the HierarchicalProperties hierarchy.
Note that no conversion will occurr, the value is simple verified to be
assignable to the requested type and then casted to it.
Parameters: name - the name whose associated value will be returned Parameters: type - the class that the value has to be retrieved as Parameters: defaultValue - the value that should be used as a fallback the associated PropertyValue as an instance of theprovided type; or
Sets the parent of this HierarchicalProperties instance.
Parameters: parent - the parent of this instance; or null if thisinstance should be isolated this HierarchicalProperties instance See Also:HierarchicalProperties.getParent since: 1.1
Associates the specified value with the specified name in this
HierarchicalProperties instance. If it previously
contained a mapping for this name, the old value is replaced by the
specified value.
Parameters: name - the name that will be associated with the property Parameters: value - the property value that will be associated with thespecified name this HierarchicalProperties instance See Also:HierarchicalProperties.put(String,Object) See Also:HierarchicalProperties.putAll since: 1.1
Associates the specified fixed object value with the specified name
in this HierarchicalProperties instance. If it previously
contained a mapping for this name, the old value is replaced by the
specified value.
Parameters: name - the name that will be associated with the property Parameters: value - the property value that will be associated with thespecified name, note that this method will create a PropertyValueObjectinstance that will contain the value in a fixed manner this HierarchicalProperties instance See Also:HierarchicalProperties.put(String,PropertyValue) See Also:HierarchicalProperties.putAll since: 1.6
Copies all of the named properties from the specified
HierarchicalProperties instance to this
HierarchicalProperties instance. The effect of this call
is equivalent to that of calling
HierarchicalProperties.put on this
HierarchicalProperties once for each mapping from the
specified HierarchicalProperties instance.
Parameters: source - the properties that will be stored in thisHierarchicalProperties instance this HierarchicalProperties instance See Also:HierarchicalProperties.put since: 1.1
Copies all of the entries for a Map instance to this
HierarchicalProperties instance.
Parameters: source - the map entries that will be stored in thisHierarchicalProperties instance this HierarchicalProperties instance since: 1.5
Removes the mapping for this name from this
HierarchicalProperties instance, if it is present.
Parameters: name - the name that will be removed the previously associated value; or
null if the name wasn't found in thisHierarchicalProperties instance since: 1.1
Sets the parent of this HierarchicalProperties instance.
Parameters: parent - the parent of this instance; or null if thisinstance should be isolated See Also:HierarchicalProperties.getParent since: 1.1