public abstract class ConfigBase extends java.lang.Object implements Config
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,ComplexOption> |
optionGroups |
protected Option[] |
options |
Constructor and Description |
---|
ConfigBase() |
Modifier and Type | Method and Description |
---|---|
protected ComplexOption |
addComplexOption(java.lang.String sGroup) |
ComplexOption |
getComplexOption(java.lang.String sGroup)
Get a complex option
|
protected abstract java.lang.String |
getDefaultConfigPath() |
java.lang.String |
getOption(java.lang.String sName)
Get a named option
|
protected abstract int |
getOptionCount() |
void |
read(java.io.File file)
Read a configuration (file based version)
|
void |
read(java.io.InputStream is)
Read configuration from a specified input stream
|
void |
readDefaultConfig(java.lang.String sName)
Read a default configuration: The available configurations depend on the
Converter implementation |
protected abstract void |
readInner(org.w3c.dom.Element elm)
Read configuration information from an xml element.
|
void |
setOption(java.lang.String sName,
java.lang.String sValue)
Set a name/value option.
|
void |
write(java.io.File file)
Write the configuration (file based version)
|
void |
write(java.io.OutputStream os)
Write the configuration (stream based version)
|
protected abstract void |
writeInner(org.w3c.dom.Document dom)
Write configuration information to an xml document.
|
protected Option[] options
protected java.util.Map<java.lang.String,ComplexOption> optionGroups
protected abstract int getOptionCount()
protected abstract java.lang.String getDefaultConfigPath()
public void setOption(java.lang.String sName, java.lang.String sValue)
Config
Converter
implementation as well as null values are
silently ignoredpublic java.lang.String getOption(java.lang.String sName)
Config
public ComplexOption getComplexOption(java.lang.String sGroup)
Config
getComplexOption
in interface Config
sGroup
- the name of the complex optionprotected ComplexOption addComplexOption(java.lang.String sGroup)
public void readDefaultConfig(java.lang.String sName) throws java.lang.IllegalArgumentException
Config
Converter
implementationreadDefaultConfig
in interface Config
sName
- the name of the configurationjava.lang.IllegalArgumentException
- if the configuration does not existpublic void read(java.io.InputStream is) throws java.io.IOException
Read configuration from a specified input stream
public void read(java.io.File file) throws java.io.IOException
Config
protected abstract void readInner(org.w3c.dom.Element elm)
public void write(java.io.OutputStream os) throws java.io.IOException
Config
public void write(java.io.File file) throws java.io.IOException
Config
protected abstract void writeInner(org.w3c.dom.Document dom)