ch.elca.el4j.util.config
Class HierarchicalGenericConfig

java.lang.Object
  extended by ch.elca.el4j.util.config.GenericConfig
      extended by 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).
 
Fields inherited from class ch.elca.el4j.util.config.GenericConfig
m_map
 
Constructor Summary
HierarchicalGenericConfig()
           
 
Method Summary
 void add(String key, Object value)
          
 Object get(String key)
          
 Map<String,Object> getChildren()
           
 Map<String,Object> getMap()
          
 String getPrefix()
           
 HierarchicalGenericConfig getSubConfig(String prefix)
           
 void setMap(Map<String,Object> map)
          
 void setOverrideMap(Map<String,Object> map)
          
 void setOverrideMap(Properties properties)
          
 void setPrefix(String prefix)
           
 String toString()
          
 
Methods inherited from class ch.elca.el4j.util.config.GenericConfig
setMap, setParent, setParents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_prefix

protected String m_prefix
The prefix for this config (used in subconfigs).

Constructor Detail

HierarchicalGenericConfig

public HierarchicalGenericConfig()
Method Detail

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 add
value - 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.