org.nakedobjects.utility
Class ComponentLoader

java.lang.Object
  extended byorg.nakedobjects.utility.ComponentLoader

public class ComponentLoader
extends java.lang.Object


Constructor Summary
ComponentLoader()
           
 
Method Summary
static java.lang.Object loadComponent(java.lang.String paramName, java.lang.Class requiredClass)
          Loads a component required by the system, as specfied in the configuration file.
static java.lang.Object loadComponent(java.lang.String paramName, java.lang.String defaultType, java.lang.Class requiredClass)
          Loads a component required by the system, as specfied in the configuration file.
static java.lang.Object loadComponentIfRequired(java.lang.String paramName, java.lang.Class requiredClass)
           
static java.lang.Object loadComponentIfRequired(java.lang.String paramName, java.lang.String defaultType, java.lang.Class requiredClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentLoader

public ComponentLoader()
Method Detail

loadComponent

public static java.lang.Object loadComponent(java.lang.String paramName,
                                             java.lang.Class requiredClass)
                                      throws ConfigurationException
Loads a component required by the system, as specfied in the configuration file. If there is no class specified in the configuration file then the default class is used.

Parameters:
paramName - the parameter name to match with the configuration file
requiredClass - the type of component that must be specified
Returns:
Object the loaded component
Throws:
ConfigurationException - thrown if there is no component specified, the class cannot be found, the class is of the wrong type, or there is a problem loading or accessing it.

loadComponentIfRequired

public static java.lang.Object loadComponentIfRequired(java.lang.String paramName,
                                                       java.lang.Class requiredClass)
                                                throws ConfigurationException
Throws:
ConfigurationException

loadComponent

public static java.lang.Object loadComponent(java.lang.String paramName,
                                             java.lang.String defaultType,
                                             java.lang.Class requiredClass)
                                      throws ConfigurationException
Loads a component required by the system, as specfied in the configuration file. If there is no class specified in the configuration file then the default class is used.

Parameters:
paramName - the parameter name to match with the configuration file
defaultType - the name of the class to use for the default component
requiredClass - the type of component that must be specified
Returns:
Object the loaded component
Throws:
ConfigurationException - thrown if there is no component specified, the class cannot be found, the class is of the wrong type, or there is a problem loading or accessing it.

loadComponentIfRequired

public static java.lang.Object loadComponentIfRequired(java.lang.String paramName,
                                                       java.lang.String defaultType,
                                                       java.lang.Class requiredClass)
                                                throws ConfigurationException
Throws:
ConfigurationException