|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.initializer.Configuration
This class is used by the initialization system to pass configuration parameters to an initializer. Every initializer should contain a member variable with exactly one instance of this class. The initializer should instantiate this class in the constructor and set the types and optionally set default values for each parameter the initializer requires.
public class MyInitializer implements Initializer { Configuration m_config = new Configuration(); public MyInitializer() throws InitializationException { m_config.initParameter("stringParam", "This is a usage string.", String.class,"This is a string."); m_config.initParameter("intParam", "Please enter a value for the intParam.") m_config.initParameter("listParam", "Should be a list.", java.util.List.class, new ArrayList()); } public Configuration getConfiguration() { return m_config; } public void startup() { // Run startup code here. } public void shutdown() { // Run shutdown code here. } }
Field Summary | |
static String |
versionId
|
Constructor Summary | |
Configuration()
|
Method Summary | |
Object |
getParameter(String name)
Returns the parameter value for the parameter specified by name. |
Set |
getParameterNames()
Returns the legal parameter names for this Configuration object. |
boolean |
hasParameter(String name)
Returns true if this configuration has the specified parameter. |
void |
initParameter(String name,
String usage,
Class type)
Initializes the parameter, passing in null as the default value. |
void |
initParameter(String name,
String usage,
Class type,
Object defaultValue)
Initializes the parameter to the default value. |
void |
setParameter(String name,
Object value)
Sets the parameter specified by name to the value |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String versionId
Constructor Detail |
public Configuration()
Method Detail |
public void initParameter(String name, String usage, Class type, Object defaultValue) throws InitializationException
name
- The parameter name.usage
- Documentation on the parameter usage.type
- The parameter type.defaultValue
- The parameter default value.
InitializationException
public void initParameter(String name, String usage, Class type) throws InitializationException
name
- The parameter name.usage
- Documentation on the parameter usage.type
- The parameter type.
InitializationException
public void setParameter(String name, Object value) throws InitializationException
name
- The parameter name.value
- The parameter value.
InitializationException
public Object getParameter(String name) throws InitializationException
name
- The parameter name.
InitializationException
public boolean hasParameter(String name)
name
- The parameter.
public Set getParameterNames()
public String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |