public class ConfigMap extends LinkedHashMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
ConfigMap()
Constructs an empty
ConfigMap with the default initial
capacity of 10. |
ConfigMap(ConfigMap m)
Constructs a new
ConfigMap and copies the values
from the supplied map to this map. |
ConfigMap(int initialCapacity)
Constructs a new
ConfigMap with the initial
capacity specified. |
| Modifier and Type | Method and Description |
|---|---|
void |
addProperties(ConfigMap p)
Adds all properties from a map to this map.
|
void |
addProperty(String name,
ConfigMap value)
Adds a
ConfigMap value to this map for the given property
name. |
void |
addProperty(String name,
String value)
Adds a
String value to this map for the given property
name. |
void |
allowProperty(String name)
Sets a property name as allowed without needing to access the property
value.
|
List |
findAllUnusedProperties()
Returns a list of qualified property names that have not been accessed
by one of the get*() methods.
|
void |
findUnusedProperties(String parentPath,
boolean recurse,
Collection result)
Gathers a collection of properties that exist in the map but have not
been explicitly accessed nor marked as allowed.
|
Object |
get(Object name)
Gets the value for the given property name.
|
String |
getProperty(String name)
Gets the property with the specified name as a string if possible.
|
boolean |
getPropertyAsBoolean(String name,
boolean defaultValue)
Gets the property with the specified name as a boolean if possible,
or returns the default value if the property is undefined.
|
int |
getPropertyAsInt(String name,
int defaultValue)
Gets the property with the specified name as an int if possible,
or returns the default value if the property is undefined.
|
List |
getPropertyAsList(String name,
List defaultValue)
Gets a property (or set of properties) as a List.
|
long |
getPropertyAsLong(String name,
long defaultValue)
Gets the property with the specified name as a long if possible,
or returns the default value if the property is undefined.
|
ConfigMap |
getPropertyAsMap(String name,
ConfigMap defaultValue)
Gets the property with the specified name as a ConfigMap if possible,
or returns the default value if the property is undefined.
|
String |
getPropertyAsString(String name,
String defaultValue)
Gets the property with the specified name as a String if possible,
or returns the default value if the property is undefined.
|
Set |
propertyNames()
Gets the set of property names contained in this map.
|
clear, containsValue, removeEldestEntryclone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCode, toStringpublic ConfigMap()
ConfigMap with the default initial
capacity of 10.public ConfigMap(int initialCapacity)
ConfigMap with the initial
capacity specified.initialCapacity - the initial capacity.public ConfigMap(ConfigMap m)
ConfigMap and copies the values
from the supplied map to this map.m - a ConfigMap whose properties are to be added to
this ConfigMap.public void addProperties(ConfigMap p)
p - a ConfigMap whose properties are to be added to
this ConfigMap.public void addProperty(String name, String value)
String value to this map for the given property
name.name - the property namevalue - the property valuepublic void addProperty(String name, ConfigMap value)
ConfigMap value to this map for the given property
name.name - the property namevalue - the property valuepublic Set propertyNames()
Set of property name Strings.public void allowProperty(String name)
name - the property name to allowpublic Object get(Object name)
get in interface Mapget in class LinkedHashMapname - the property namepublic String getProperty(String name)
name - The property name.public ConfigMap getPropertyAsMap(String name, ConfigMap defaultValue)
name - the property namedefaultValue - the default valuepublic String getPropertyAsString(String name, String defaultValue)
name - the property namedefaultValue - the default valuepublic List getPropertyAsList(String name, List defaultValue)
name - the property namedefaultValue - the value to return if the property is not foundpublic boolean getPropertyAsBoolean(String name, boolean defaultValue)
name - the property namedefaultValue - the default valuepublic int getPropertyAsInt(String name, int defaultValue)
name - the property namedefaultValue - the default valuepublic long getPropertyAsLong(String name, long defaultValue)
name - the property namedefaultValue - the default valuepublic List findAllUnusedProperties()
public void findUnusedProperties(String parentPath, boolean recurse, Collection result)
parentPath - Used to track the depth of property in a potential
hierarchy of ConfigMaps.recurse - Whether sub maps should be recursively searched.result - the collection of unused properties in this map.Copyright © 2015 The Apache Software Foundation. All rights reserved.