public final class ConfigParseOptions extends java.lang.Object
This object is immutable, so the "setters" return a new object.
Here is an example of creating a custom ConfigParseOptions
:
ConfigParseOptions options = ConfigParseOptions.defaults() .setSyntax(ConfigSyntax.JSON) .setAllowMissing(false)
Modifier and Type | Method and Description |
---|---|
ConfigParseOptions |
appendIncluder(ConfigIncluder includer)
Appends a
ConfigIncluder which customizes how
includes are handled. |
static ConfigParseOptions |
defaults()
Gets an instance of
ConfigParseOptions with all fields
set to the default values. |
boolean |
getAllowMissing()
Gets the current "allow missing" flag.
|
java.lang.ClassLoader |
getClassLoader()
Get the class loader; never returns
null , if the class loader was
unset, returns
Thread.currentThread().getContextClassLoader() . |
ConfigIncluder |
getIncluder()
Gets the current includer (will be null for the default includer).
|
java.lang.String |
getOriginDescription()
Gets the current origin description, which may be null for "automatic".
|
ConfigSyntax |
getSyntax()
Gets the current syntax option, which may be null for "any".
|
ConfigParseOptions |
prependIncluder(ConfigIncluder includer)
Prepends a
ConfigIncluder which customizes how
includes are handled. |
ConfigParseOptions |
setAllowMissing(boolean allowMissing)
Set to false to throw an exception if the item being parsed (for example
a file) is missing.
|
ConfigParseOptions |
setClassLoader(java.lang.ClassLoader loader)
Set the class loader.
|
ConfigParseOptions |
setIncluder(ConfigIncluder includer)
Set a
ConfigIncluder which customizes how includes are handled. |
ConfigParseOptions |
setOriginDescription(java.lang.String originDescription)
Set a description for the thing being parsed.
|
ConfigParseOptions |
setSyntax(ConfigSyntax syntax)
Set the file format.
|
ConfigParseOptions |
setSyntaxFromFilename(java.lang.String filename)
Set the file format.
|
public static defaults()
ConfigParseOptions
with all fields
set to the default values. Start with this instance and make any
changes you need.public setSyntax(ConfigSyntax syntax)
ConfigSyntax.CONF
.syntax
- a syntax or null
for best guesspublic setSyntaxFromFilename(java.lang.String filename)
ConfigSyntax.CONF
.filename
- a configuration file namepublic getSyntax()
public setOriginDescription(java.lang.String originDescription)
ConfigOrigin
of the parsed values.originDescription
- description to put in the ConfigOrigin
public java.lang.String getOriginDescription()
public setAllowMissing(boolean allowMissing)
allowMissing
- true to silently ignore missing itempublic boolean getAllowMissing()
public setIncluder(ConfigIncluder includer)
ConfigIncluder
which customizes how includes are handled.
null means to use the default includer.includer
- the includer to use or null for defaultpublic prependIncluder(ConfigIncluder includer)
ConfigIncluder
which customizes how
includes are handled. To prepend your includer, the
library calls ConfigIncluder.withFallback(com.typesafe.config.ConfigIncluder)
on your
includer to append the existing includer to it.includer
- the includer to prepend (may not be null)public appendIncluder(ConfigIncluder includer)
ConfigIncluder
which customizes how
includes are handled. To append, the library calls ConfigIncluder.withFallback(com.typesafe.config.ConfigIncluder)
on the existing includer.includer
- the includer to append (may not be null)public getIncluder()
public setClassLoader(java.lang.ClassLoader loader)
Thread.currentThread().getContextClassLoader()
will be used.loader
- a class loader or null
to use thread context class
loaderpublic java.lang.ClassLoader getClassLoader()
null
, if the class loader was
unset, returns
Thread.currentThread().getContextClassLoader()
.