org.chwf.config
Class ConfigFactory

java.lang.Object
  |
  +--org.chwf.config.ConfigFactory

public abstract class ConfigFactory
extends java.lang.Object

Author:
Paul Strack

Constructor Summary
ConfigFactory()
           
 
Method Summary
static Config getConfig(java.lang.Class contextClass)
          Factory method for Config class.
static Config getConfig(java.lang.Class contextClass, java.util.Locale locale)
          Factory method for Config class.
static Config getConfig(java.lang.String resource)
          Factory method for Config class.
static Config getConfig(java.lang.String resource, java.util.Locale locale)
          Factory method for Config class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigFactory

public ConfigFactory()
Method Detail

getConfig

public static Config getConfig(java.lang.Class contextClass)
                        throws ConfigurationException

Factory method for Config class.

Parameters:
contextClass - The context class for the configuration.
Returns:
The Config object for the given class.
Throws:
ConfigurationException - For errors in loading configuration data.

getConfig

public static Config getConfig(java.lang.Class contextClass,
                               java.util.Locale locale)
                        throws ConfigurationException

Factory method for Config class.

Parameters:
contextClass - The context class for the configuration.
locale - The locale.
Returns:
The Config object for the given class.
Throws:
ConfigurationException - For errors in loading configuration data.

getConfig

public static Config getConfig(java.lang.String resource)
                        throws ConfigurationException
Factory method for Config class. The resource name should be the location of the file in the classpath, with "." separating directories rather than "/". If you use "/" or your operating systems path separator, they will be replaced by ".". The resource name should omit the file extension (".properties" or ".xml"). This factory method can be used for resources that are not associated with any particular class.

Parameters:
resource - The name of the resource.
Returns:
The Config object for the given resource.
Throws:
ConfigurationException - For errors in loading configuration data.

getConfig

public static Config getConfig(java.lang.String resource,
                               java.util.Locale locale)
                        throws ConfigurationException
Factory method for Config class. As getConfig(java.lang.String), but include a locale for internationalization.

Parameters:
resource - The name of the resource.
locale - The locale.
Returns:
The Config object for the given resource.
Throws:
ConfigurationException - For errors in loading configuration data.


Copyright © 2002-2004, Paul Strack. All Rights Reserved.