|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.AbstractMap
|
+--com.go.trove.util.PropertyMap
A class that is similar to java.util.Properties but preserves
original property order and supports a special subMap(java.lang.String) view
operation. PropertyMap also has more convenience methods for getting
properties as certain types.
| Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
| Field Summary | |
static java.lang.Class |
ELEMENT_TYPE
|
| Constructor Summary | |
PropertyMap()
Construct a PropetyMap using a dot (".") separator. |
|
PropertyMap(java.util.Map map)
|
|
PropertyMap(java.util.Map map,
java.lang.String separator)
|
|
PropertyMap(java.lang.String separator)
|
|
| Method Summary | |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsKey(java.lang.String key)
|
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
java.lang.Object |
get(java.lang.String key)
|
boolean |
getBoolean(java.lang.String key)
Returns true only if value is "true", ignoring case. |
boolean |
getBoolean(java.lang.String key,
boolean def)
Returns the default value if the given key isn't in this PropertyMap or if the the value isn't equal to "true", ignoring case. |
int |
getInt(java.lang.String key)
Returns 0 if the given key isn't in this PropertyMap. |
int |
getInt(java.lang.String key,
int def)
Returns the default value if the given key isn't in this PropertyMap or isn't a valid integer. |
java.lang.Integer |
getInteger(java.lang.String key)
Returns null if the given key isn't in this PropertyMap or it isn't a valid integer. |
java.lang.Integer |
getInteger(java.lang.String key,
java.lang.Integer def)
Returns the default value if the given key isn't in this PropertyMap or it isn't a valid integer. |
java.lang.Number |
getNumber(java.lang.String key)
Returns null if the given key isn't in this PropertyMap. |
java.lang.Number |
getNumber(java.lang.String key,
java.lang.Number def)
Returns the default value if the given key isn't in this PropertyMap or isn't a valid number. |
java.lang.String |
getSeparator()
|
java.lang.String |
getString(java.lang.String key)
Returns null if the given key isn't in this PropertyMap. |
java.lang.String |
getString(java.lang.String key,
java.lang.String def)
Returns the default value if the given key isn't in this PropertyMap. |
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
The key is always converted to a String. |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
|
void |
putDefaults(java.util.Map map)
Copies the entries of the given map into this one only for keys that aren't contained in this map. |
java.lang.Object |
remove(java.lang.Object key)
|
java.lang.Object |
remove(java.lang.String key)
|
int |
size()
|
PropertyMap |
subMap(java.lang.String key)
Returns a view of this map for keys that are the same as the given key, or start with it (and a separator). |
java.util.Set |
subMapKeySet()
Returns the key names of each sub-map in this PropertyMap. |
java.util.Collection |
values()
|
| Methods inherited from class java.util.AbstractMap |
containsValue, equals, hashCode, putAll, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.Class ELEMENT_TYPE
| Constructor Detail |
public PropertyMap()
public PropertyMap(java.util.Map map)
map - Map of defaults.public PropertyMap(java.lang.String separator)
separator - Sub-key separator, i.e. ".".
public PropertyMap(java.util.Map map,
java.lang.String separator)
map - Optional map of defaults.separator - Sub-key separator, i.e. ".".putDefaults(Map)| Method Detail |
public java.lang.String getSeparator()
public PropertyMap subMap(java.lang.String key)
A sub-map of
"x" = "a" "foo" = "b" "foo." = "c" "foo.bar" = "d" "foo.bar.splat" = "e" "foo..bar" = "f" ".foo" = "g" "" = "h" null = "i"using a key of "foo" results in
null = "b" "" = "c" "bar" = "d" "bar.splat" = "e" ".bar" = "f"using a key of "x" results in
null = "a"using a key of "" results in
"foo" = "g" null = "h"and using a key of null results in the original map.
public java.util.Set subMapKeySet()
public int size()
size in class java.util.AbstractMappublic boolean isEmpty()
isEmpty in class java.util.AbstractMappublic boolean containsKey(java.lang.Object key)
containsKey in class java.util.AbstractMappublic boolean containsKey(java.lang.String key)
public java.lang.Object get(java.lang.Object key)
get in class java.util.AbstractMappublic java.lang.Object get(java.lang.String key)
public java.lang.String getString(java.lang.String key)
key - Key of property to read
public java.lang.String getString(java.lang.String key,
java.lang.String def)
key - Key of property to readdef - Default value
public int getInt(java.lang.String key)
throws java.lang.NumberFormatException
key - Key of property to read
public int getInt(java.lang.String key,
int def)
key - Key of property to readdef - Default valuepublic java.lang.Integer getInteger(java.lang.String key)
key - Key of property to read
public java.lang.Integer getInteger(java.lang.String key,
java.lang.Integer def)
key - Key of property to readdef - Default value
public java.lang.Number getNumber(java.lang.String key)
throws java.lang.NumberFormatException
key - Key of property to read
public java.lang.Number getNumber(java.lang.String key,
java.lang.Number def)
key - Key of property to readdef - Default valuepublic boolean getBoolean(java.lang.String key)
key - Key of property to read
public boolean getBoolean(java.lang.String key,
boolean def)
key - Key of property to readdef - Default valuepublic java.util.Set entrySet()
entrySet in class java.util.AbstractMappublic java.util.Set keySet()
keySet in class java.util.AbstractMappublic java.util.Collection values()
values in class java.util.AbstractMap
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in class java.util.AbstractMap
public java.lang.Object put(java.lang.String key,
java.lang.Object value)
public void putDefaults(java.util.Map map)
public java.lang.Object remove(java.lang.Object key)
remove in class java.util.AbstractMappublic java.lang.Object remove(java.lang.String key)
public void clear()
clear in class java.util.AbstractMap
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||