public class PropertyTree extends Object implements Map
| Constructor and Description |
|---|
PropertyTree()
Creates an empty instance with no parent
|
PropertyTree(boolean flat)
Creates an empty instance with no parent.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Unsupported, since you can't change the contents of a PropertyTree once it has been initialized.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set |
entrySet()
Returns an unmodifiable Set containing all key,value pairs in this PropertyTree and its children.
|
Object |
get(Object key)
Traverses the tree structure until it finds the PropertyTree pointed to by the given key, and returns that PropertyTree
instance.
|
Map |
getDirectChildren() |
String |
getProperty(String key) |
boolean |
isEmpty() |
Set |
keySet()
Returns an unmodifiable Set containing the keys of all of the entries of this PropertyTree.
|
Object |
put(Object key,
Object value)
Unsupported, since you can't change the contents of a PropertyTree once it has been initialized.
|
void |
putAll(Map t)
Unsupported, since you can't change the contents of a PropertyTree once it has been initialized.
|
Object |
remove(Object key)
Unsupported, since you can't change the contents of a PropertyTree once it has been initialized.
|
void |
setProperties(Map<String,String> properties) |
void |
setProperties(Properties properties)
Inserts all properties from the given Properties instance into this PropertyTree.
|
void |
setProperty(String key,
String value)
Associates the given key with the given value.
|
int |
size() |
String |
toString()
Returns the directValue of this PropertyTree, or null if there is none.
|
Collection |
values()
Returns an unmodifiable Collection containing the values of all of the entries of this PropertyTree.
|
public PropertyTree()
public PropertyTree(boolean flat)
public void setProperty(String key, String value)
PropertyTree tree = new PropertyTree();
tree.set( "a.b.c", "something" );
the following statements are
equivalent ways to retrieve the value:
Object one = tree.get( "a.b.c" );
Object two = tree.get( "a" ).get( "b" ).get( "c" );
key - value - IllegalArgumentException - if the key is nullIllegalArgumentException - if the value is nullpublic void setProperties(Properties properties)
properties - IllegalArgumentException - if the Properties object is nullIllegalArgumentException - if a property's key is nullIllegalArgumentException - if a property's value is nullpublic void setProperties(Map<String,String> properties)
public String getProperty(String key)
key - public Map getDirectChildren()
public String toString()
This is the hack that makes it possible for jstl to get what it needs when trying to retrive the value of a simple key or of a complex (multi-part) key.
public Set entrySet()
entrySet in interface MapMap.entrySet()public int size()
public boolean isEmpty()
isEmpty in interface MapMap.isEmpty()public Collection values()
values in interface MapMap.values()public Set keySet()
keySet in interface MapMap.keySet()public boolean containsKey(Object key)
containsKey in interface MapMap.containsKey(java.lang.Object)public boolean containsValue(Object value)
containsValue in interface MapMap.containsValue(java.lang.Object)public Object get(Object key)
Only returns PropertyTree instances; if you want the String value pointed to by a given key, you must call toString() on the returned PropertyTree (after verifying that it isn't null, of course).
get in interface MapMap.get(java.lang.Object)public void clear()
public void putAll(Map t)
public Object remove(Object key)
Copyright © 2004–2014 The Kuali Foundation. All rights reserved.