ch.elca.el4j.util.config
Class HierarchicalGenericConfig
java.lang.Object
ch.elca.el4j.util.config.GenericConfig
ch.elca.el4j.util.config.HierarchicalGenericConfig
public class HierarchicalGenericConfig
- extends GenericConfig
The base class for generic configurations. It is a hierarchical structure of
configuration entries, where entries can be added, inherited and overridden.
In addition to GenericConfig
it is possible to get all configs
starting with a specified prefix.
This can be useful for configs like
ch.elca.el4j.a = aaa
ch.elca.el4j.b = bbb
where you can use getSubConfig("ch.elca.el4j")
.
- Author:
- Stefan Wismer (SWI)
- File-location:
- HierarchicalGenericConfig
- Last check-in date:
- 2009-08-04 14:35:53 +0200 (Di, 04. Aug 2009) by swismer for revision 3875
Field Summary |
protected String |
m_prefix
The prefix for this config (used in subconfigs). |
m_prefix
protected String m_prefix
- The prefix for this config (used in subconfigs).
HierarchicalGenericConfig
public HierarchicalGenericConfig()
getMap
public Map<String,Object> getMap()
-
- Overrides:
getMap
in class GenericConfig
- Returns:
- a copy of all configuration entries declared in this config
setMap
public void setMap(Map<String,Object> map)
-
- Overrides:
setMap
in class GenericConfig
- Parameters:
map
- the configuration entries to set
setOverrideMap
public void setOverrideMap(Map<String,Object> map)
-
- Overrides:
setOverrideMap
in class GenericConfig
- Parameters:
map
- the configuration entries to add to the current entries
setOverrideMap
public void setOverrideMap(Properties properties)
-
- Overrides:
setOverrideMap
in class GenericConfig
- Parameters:
properties
- the configuration entries to add
add
public void add(String key,
Object value)
-
- Overrides:
add
in class GenericConfig
- Parameters:
key
- the key of the configuration entry to addvalue
- the value of the configuration entry to add
get
public Object get(String key)
-
- Overrides:
get
in class GenericConfig
- Parameters:
key
- the key of the configuration entry that should be returned
- Returns:
- the corresponding value or
null
if not found
getSubConfig
public HierarchicalGenericConfig getSubConfig(String prefix)
- Parameters:
prefix
- the prefix of the all configuration entries to get
- Returns:
- all entries having the specified prefix
getChildren
public Map<String,Object> getChildren()
- Returns:
- all configuration children
toString
public String toString()
-
- Overrides:
toString
in class Object
getPrefix
public String getPrefix()
- Returns:
- Returns the prefix.
setPrefix
public void setPrefix(String prefix)
- Parameters:
prefix
- Is the prefix to set.
Copyright © 2005-2011 ELCA. All Rights Reserved.