|
Cantaloop CGimlet - API Documentation, Version: 0.2.0, Date: 2002-05-13 21:30 CEST | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.cantaloop.cgimlet.OptionReader
Handlers can use a OptionReader
to read
configuration options.
A options is a element which has a key and a value attribute, for
example:
<option name="input-dir" value="src"/>
.
By default, options are stored in a Options
instance.
To customize this behaviour you can use a OptionSetter
,
which is invoked every time a option is read.
For a example of how to use an OptionReader
have a look
at the documentation of Options
.
Field Summary | |
protected OptionReaderConfigurator |
m_config
|
protected Options |
m_opt
|
protected org.dom4j.Element |
m_root
|
protected OptionSetter |
m_setter
|
Fields inherited from interface org.cantaloop.cgimlet.Constants |
LOGGER_TOPIC_PREFIX, PROJECT_NS, PROJECT_NS_URI, PROPERTY |
Constructor Summary | |
OptionReader(OptionReaderConfigurator config,
org.dom4j.Element root)
Creates a new OptionReader instance. |
|
OptionReader(OptionReaderConfigurator config,
org.dom4j.Element root,
Options opt)
Creates a new OptionReader instance. |
|
OptionReader(OptionReaderConfigurator config,
Options opt)
Creates a new OptionReader instance. |
Method Summary | |
java.lang.String |
getOption(java.lang.String key)
Get the value of the option key |
Options |
getOptions()
Get the options instance the values are written to. |
org.dom4j.Element |
getRootElement()
Get the root element of this OptionReader. |
void |
read()
Read the options of the root element of this reader. |
void |
read(org.dom4j.Element root)
Read the options of root . |
void |
setOption(java.lang.String key,
java.lang.String value)
Set option key to value . |
void |
setOptions(Options o)
Set the options instance the values are written to. |
void |
setOptionSetter(OptionSetter setter)
Set a handler which is called whenever a option has been read. |
void |
setRootElement(org.dom4j.Element root)
Set the element that should be used as the root element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.dom4j.Element m_root
protected Options m_opt
protected OptionSetter m_setter
protected OptionReaderConfigurator m_config
Constructor Detail |
public OptionReader(OptionReaderConfigurator config, org.dom4j.Element root)
OptionReader
instance.config
- the configuration for this reader.root
- the element that contains the options.public OptionReader(OptionReaderConfigurator config, Options opt)
OptionReader
instance.config
- the configuration for this reader.opt
- the Options
to store the values.public OptionReader(OptionReaderConfigurator config, org.dom4j.Element root, Options opt)
OptionReader
instance.config
- the configuration for this reader.root
- the element that contains the optionsopt
- the Options
to store the values.Method Detail |
public void setRootElement(org.dom4j.Element root)
root
- an Element
valuepublic org.dom4j.Element getRootElement()
Element
valuepublic void setOptions(Options o)
m
- a Option
valuepublic Options getOptions()
Option
valuepublic void setOptionSetter(OptionSetter setter)
null
means reverting to the
default behaviour (writing the options into a Options
instance).setter
- an OptionSetter
valuepublic java.lang.String getOption(java.lang.String key)
key.
- Parameters:
key
- a String
value- Returns:
- a
String
value
public void setOption(java.lang.String key, java.lang.String value)
key
to value
.key
- a String
valuevalue
- a String
valueString
valuepublic void read()
read(Element)
public void read(org.dom4j.Element root)
root
. All directed children
that have the attributes for key and value (specified in the constructor)
are treated as options. Options that appear several times are overwritten
|
Copyright 2001, 2002 Stefan Heimann, David Leuschner. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |