org.ocltf.common
Class Configuration

java.lang.Object
  extended byorg.ocltf.common.Configuration

public class Configuration
extends java.lang.Object

Finds and loads Configuration objects

Author:
Chad Brandon

Method Summary
 java.lang.String findPath(java.lang.Class forClass)
          Returns the path to the configuration file
static Configuration getInstance(java.lang.Class forClass)
          Returns an instance of this Configuration for the specified forClass
 java.util.Iterator getKeys()
          Get the list of the keys contained in the configuration repository.
 java.util.Iterator getKeys(java.lang.String prefix)
          Get the list of the keys contained in the configuration repository that match the specified prefix.
 java.lang.String getOptionalString(java.lang.String key)
          Retrieves the property as a String
 java.lang.String[] getOptionalStringArray(java.lang.String key)
          Retrieves the property has a array of Strings
 java.lang.String getPath()
          Returns the path to the file for this Configuration
 java.lang.String getRequiredString(java.lang.String key)
          Retrieves the property has a string.
 java.lang.String[] getRequiredStringArray(java.lang.String key)
          Retrieves the property has a array of Strings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Configuration getInstance(java.lang.Class forClass)
Returns an instance of this Configuration for the specified forClass

Parameters:
forClass -
Returns:
Configuration

findPath

public java.lang.String findPath(java.lang.Class forClass)
Returns the path to the configuration file

Parameters:
forClass - the Class which the Configuration path is for.
Returns:
String

getOptionalString

public java.lang.String getOptionalString(java.lang.String key)
Retrieves the property as a String

Parameters:
key - the key for the property
Returns:
String the value of the property or null if it can't be found.

getOptionalStringArray

public java.lang.String[] getOptionalStringArray(java.lang.String key)
Retrieves the property has a array of Strings

Parameters:
key - the key for the property
Returns:
String the value of the property or null if it can't be found.

getRequiredStringArray

public java.lang.String[] getRequiredStringArray(java.lang.String key)
Retrieves the property has a array of Strings

Parameters:
key - the key for the property
Returns:
String the value of the property or null if it can't be found.

getRequiredString

public java.lang.String getRequiredString(java.lang.String key)
Retrieves the property has a string. Will throw the runtime ConfigurationException if the property can not be found.

Parameters:
key -
Returns:
String

getKeys

public java.util.Iterator getKeys(java.lang.String prefix)
Get the list of the keys contained in the configuration repository that match the specified prefix.

Parameters:
prefix - the prefix to look for.
Returns:
Iterator

getKeys

public java.util.Iterator getKeys()
Get the list of the keys contained in the configuration repository.

Returns:
Iterator

getPath

public java.lang.String getPath()
Returns the path to the file for this Configuration

Returns:
String


Copyright © 2003-2004 Chad Brandon. All Rights Reserved.