java.lang.Object
com.github.hypfvieh.config.xml.XmlConfigBuilder
Builder for
XmlConfiguration.- Seit:
- v1.0.1 - 2018-01-15
- Autor:
- hypfvieh
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbuild()Build theXmlConfigurationand return it.setAllowKeyOverrideFromEnvironment(boolean _allowOverride) Set this to true to allow the user to override config parameters using system properties.
This means, if key foo/bar is available in config and a environment variable of the same name
exists, the value of the environment variable is used, instead of the value in config.setInputFile(File _inputFile, SearchOrder... _order) Set input file used for reading configuration.setInputFile(String _inputFile, SearchOrder... _order) Set input file used for reading configuration.setInputStream(InputStream _inputStream) SetInputStreamused to read configuration file.setKeyDelimiter(String _delimiterKey) Set the delimiter used to delimit XML nodes.
By default "/" is used, which means all pathes have to be expressed like:
foo/bar/bazsetOutputFile(File _outputFile) Set output file used for saving.setOutputFile(String _outputFile) Set output file used for saving.setOutputStream(OutputStream _outputStream) SetOutputStreamused to save configuration file.setSkipRoot(boolean _skipRoot) Set this to true to ignore the first level of nodes inside the config.
Usually each XML is starting with a single node (e.g.setXmlErrorHandler(ErrorHandler _xmlErrorHandler) Set theErrorHandlerused by the XML parser to handle XML errors.
By default a 'quiet' handler is used (suppressing all errors).
Use null here to disable validation.
-
Konstruktordetails
-
XmlConfigBuilder
public XmlConfigBuilder()
-
-
Methodendetails
-
setInputStream
SetInputStreamused to read configuration file.- Parameter:
_inputStream- input stream to read from- Gibt zurück:
- this for chaining
-
setOutputStream
SetOutputStreamused to save configuration file.- Parameter:
_outputStream- output stream to write to- Gibt zurück:
- this for chaining
-
setOutputFile
Set output file used for saving. Note: This cannot be set if outputStream is already set.- Parameter:
_outputFile- output file to write to- Gibt zurück:
- this for chaining
-
setOutputFile
Set output file used for saving. Note: This cannot be set if outputStream is already set.- Parameter:
_outputFile- output file to write to- Gibt zurück:
- this for chaining
-
setInputFile
Set input file used for reading configuration. Note: This cannot be set if inputStream is already set.- Parameter:
_inputFile- input file to read from_order- search order to use- Gibt zurück:
- this for chaining
-
setInputFile
Set input file used for reading configuration. Note: This cannot be set if inputStream is already set.- Parameter:
_inputFile- input file to read from_order- search order to use- Gibt zurück:
- this for chaining
-
setXmlErrorHandler
Set theErrorHandlerused by the XML parser to handle XML errors.
By default a 'quiet' handler is used (suppressing all errors).
Use null here to disable validation.- Parameter:
_xmlErrorHandler- error handler to use- Gibt zurück:
- this for chaining
-
setKeyDelimiter
Set the delimiter used to delimit XML nodes.
By default "/" is used, which means all pathes have to be expressed like:
foo/bar/baz- Parameter:
_delimiterKey- delimiting string- Gibt zurück:
- this for chaining
-
setSkipRoot
Set this to true to ignore the first level of nodes inside the config.
Usually each XML is starting with a single node (e.g. <Config>) and all
keys are below that node.
If this is set to true, you can use e.g. key/subKey instead of Config/key/subKey to address your values.
Default is false.- Parameter:
_skipRoot- true to skip root, false otherwise- Gibt zurück:
- this for chaining
-
setAllowKeyOverrideFromEnvironment
Set this to true to allow the user to override config parameters using system properties.
This means, if key foo/bar is available in config and a environment variable of the same name
exists, the value of the environment variable is used, instead of the value in config.
This allows the user to easily override values by e.g. using -Dfoo/bar=value instead of editing the config file every time.
Default is false- Parameter:
_allowOverride- true to enable override, false otherwise- Gibt zurück:
- this for chaining
-
build
Build theXmlConfigurationand return it. Will create a newXmlConfigurationon each call.- Gibt zurück:
XmlConfiguration
-