jcckit.util
Class PropertiesBasedConfigData

java.lang.Object
  extended byjcckit.util.FlatConfigData
      extended byjcckit.util.PropertiesBasedConfigData
All Implemented Interfaces:
ConfigData

public class PropertiesBasedConfigData
extends FlatConfigData

Implementation of FlatConfigData based on java.util.Properties.

Author:
Franz-Josef Elmer

Constructor Summary
PropertiesBasedConfigData(java.util.Properties properties)
          Creates an instance based on the specified properties.
PropertiesBasedConfigData(java.lang.String fileName)
          Creates an instance from the specified .properties file.
 
Method Summary
protected  ConfigData createConfigData(java.lang.String path)
          Returns a new instance of PropertiesBasedConfigData for the specified full path.
protected  java.lang.String getValue(java.lang.String fullKey)
          Returns the value for the specified full key.
 
Methods inherited from class jcckit.util.FlatConfigData
get, getFullKey, getNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesBasedConfigData

public PropertiesBasedConfigData(java.lang.String fileName)
                          throws java.io.IOException
Creates an instance from the specified .properties file.

Parameters:
fileName - File name of the .properties file relative to the working directory or absolute.
Throws:
java.io.IOException - if the .properties does not exist or could not be read.

PropertiesBasedConfigData

public PropertiesBasedConfigData(java.util.Properties properties)
Creates an instance based on the specified properties. The path is undefined.

Method Detail

getValue

protected java.lang.String getValue(java.lang.String fullKey)
Returns the value for the specified full key. The call will be delegated to the wrapped java.util.properties object.

Specified by:
getValue in class FlatConfigData
Parameters:
fullKey - The full key including path. null is not allowed.
Returns:
the value or null if not found.

createConfigData

protected ConfigData createConfigData(java.lang.String path)
Returns a new instance of PropertiesBasedConfigData for the specified full path. The wrapped java.util.Properties will be the same as of this instance.

Specified by:
createConfigData in class FlatConfigData
Parameters:
path - The full path.
Returns:
a new instance.