org.kuali.rice.kns.util
Class JstlPropertyHolder
java.lang.Object
org.kuali.rice.kns.util.JstlPropertyHolder
- All Implemented Interfaces:
- Map
- Direct Known Subclasses:
- ConfigProperties
public abstract class JstlPropertyHolder
- extends Object
- implements Map
This class implements the Map interface for a Properties instance. Exports all properties from the given Properties instance as
constants, usable from jstl. Implements the Map interface (by delegating everything to the PropertyTree, which really implements
the Map methods directly) so that jstl can translate ${Constants.a} into a call to ConfigConstants.get( "a" ).
The contents of this Map cannot be changed once it has been initialized. Any calls to any of the Map methods made before the
propertyTree has been initialized (i.e. before setProperties has been called) will throw an IllegalStateException.
Jstl converts ${Constants.a.b.c} into get("a").get("b").get("c"), so the properties are stored in a PropertyTree, which converts
the initial set( "a.b.c", "value" ) into construction of the necessary tree structure to support get("a").get("b").get("c").
Implicitly relies on the assumption that the JSP will be calling toString() on the result of the final get
, since
get
can only return one type, and that type must be the complex one so that further dereferencing will be
possible.
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
propertyTree
private PropertyTree propertyTree
JstlPropertyHolder
public JstlPropertyHolder()
- Default constructor
setProperties
protected void setProperties(Properties properties)
- Creates a propertyTree to store the given properties
- Parameters:
properties
-
setPropertyTree
protected void setPropertyTree(PropertyTree tree)
- Copies in the given propertyTree rather than building its own. Reasonably dangerous, since that tree might presumably be
modified, violating the readonlyness of this datastructure.
- Parameters:
properties
-
get
public Object get(Object key)
- Specified by:
get
in interface Map
- See Also:
PropertyTree.get(java.lang.Object)
size
public int size()
- Specified by:
size
in interface Map
- See Also:
PropertyTree.size()
clear
public void clear()
- Specified by:
clear
in interface Map
- See Also:
PropertyTree.clear()
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Map
- See Also:
PropertyTree.isEmpty()
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interface Map
- See Also:
PropertyTree.containsKey(java.lang.Object)
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interface Map
- See Also:
PropertyTree.containsValue(java.lang.Object)
values
public Collection values()
- Specified by:
values
in interface Map
- See Also:
PropertyTree.values()
putAll
public void putAll(Map m)
- Specified by:
putAll
in interface Map
- See Also:
PropertyTree.putAll(java.util.Map)
entrySet
public Set entrySet()
- Specified by:
entrySet
in interface Map
- See Also:
PropertyTree.entrySet()
keySet
public Set keySet()
- Specified by:
keySet
in interface Map
- See Also:
PropertyTree.keySet()
remove
public Object remove(Object key)
- Specified by:
remove
in interface Map
- See Also:
PropertyTree.remove(java.lang.Object)
put
public Object put(Object key,
Object value)
- Specified by:
put
in interface Map
- See Also:
PropertyTree.put(java.lang.Object, java.lang.Object)
Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.