diff --git a/latest/api/allclasses-frame.html b/latest/api/allclasses-frame.html index 32b07c7f..5d3e2fbf 100644 --- a/latest/api/allclasses-frame.html +++ b/latest/api/allclasses-frame.html @@ -2,12 +2,12 @@
- +public abstract class ConfigException
public abstract class ConfigException
@@ -393,6 +393,9 @@ public + @@ -182,6 +182,15 @@ Contains static methods for creating
static void
invalidateCaches()
+
+static Config
load()
@@ -758,7 +767,9 @@ public static load("application")
in most cases. This configuration should be used by
libraries and frameworks unless an application provides a different one.
- This method may return a cached singleton.
+ This method may return a cached singleton so will not see changes to
+ system properties or config files. (Use invalidateCaches()
to
+ force it to reload.)
If the system properties config.resource
,
config.file
, or config.url
are set, then the
@@ -954,6 +965,35 @@ public static
+public static void invalidateCaches()+
Config
is immutable, anyone with a reference
+ to the old configs will still have the same outdated objects. However,
+ new calls to load()
or defaultOverrides()
or
+ defaultReference()
may return a new object.
+ + This method is primarily intended for use in unit tests, for example, + that may want to update a system property then confirm that it's used + correctly. In many cases, use of this method may indicate there's a + better way to set up your code. +
+ Caches may be reloaded immediately or lazily; once you call this method,
+ the reload can occur at any time, even during the invalidation process.
+ So FIRST make the changes you'd like the caches to notice, then SECOND
+ call this method to invalidate caches. Don't expect that invalidating,
+ making changes, then calling load()
, will work. Make changes
+ before you invalidate.
+
+
@@ -996,16 +1036,19 @@ public staticSystem.getProperties()
, parsed and converted as with -parseProperties(java.util.Properties, com.typesafe.config.ConfigParseOptions)
. This method can return a global immutable - singleton, so it's preferred over parsing system properties yourself. - +parseProperties(java.util.Properties, com.typesafe.config.ConfigParseOptions)
. ++ This method can return a global immutable singleton, so it's preferred + over parsing system properties yourself.
load(java.lang.String)
will include the system properties as overrides already, as willdefaultReference()
anddefaultOverrides()
.Because this returns a singleton, it will not notice changes to system - properties made after the first time this method is called. + properties made after the first time this method is called. Use +
invalidateCaches()
to force the singleton to reload if you + modify system properties.
boolean
getJson()
+
+ boolean
getOriginComments()
ConfigRenderOptions
setJson(boolean value)
+
+ ConfigRenderOptions
setOriginComments(boolean value)
String
toString()
+
+Methods inherited from class java.lang.Object | |
---|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ConfigValue.origin()
of that setting's value. For example these
comments might tell you which file a setting comes from.
-
+
setOriginComments()
controls only these autogenerated
"origin of this setting" comments, to toggle regular comments use
@@ -341,6 +365,53 @@ public boolean getFormatted()
+public ConfigRenderOptions setJson(boolean value)+
setComments(boolean)
+ and setOriginComments(boolean)
options. So if you enable
+ comments you will get invalid JSON despite setting this to true.
++
value
- true to include non-JSON extensions in the render
++public boolean getJson()+
+
+public String toString()+
toString
in class Object
ConfigList
, which
@@ -482,6 +485,10 @@ Method in interface com.typesafe.config.includeURL(ConfigIncludeContext, URL) -
Method in interface com.typesafe.config.ConfigIncluderURL
Config
's root object contains no key-value
@@ -774,6 +781,9 @@ Method in class com.typesafe.config.setIncluder(ConfigIncluder) -
Method in class com.typesafe.config.ConfigParseOptions
Config
instance, enabling you to use
path expressions to find values in the object.
+-Serialized Fields | +Serialization Methods
---|
-ConfigOrigin origin+private void readObject(ObjectInputStream in) + throws IOException, + ClassNotFoundException
IOException
+ClassNotFoundException
+private void writeObject(ObjectOutputStream out) + throws IOException
IOException
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface Config
+An immutable map from config paths to config values. + +
+ Contrast with ConfigObject
which is a map from config keys,
+ rather than paths, to config values. A Config
contains a tree of
+ ConfigObject
, and root()
returns the tree's root
+ object.
+
+
+ Throughout the API, there is a distinction between "keys" and "paths". A key + is a key in a JSON object; it's just a string that's the key in a map. A + "path" is a parseable expression with a syntax and it refers to a series of + keys. Path expressions are described in the spec for + Human-Optimized Config Object Notation. In brief, a path is + period-separated so "a.b.c" looks for key c in object b in object a in the + root object. Sometimes double quotes are needed around special characters in + path expressions. + +
+ The API for a Config
is in terms of path expressions, while the API
+ for a ConfigObject
is in terms of keys. Conceptually, Config
+ is a one-level map from paths to values, while a
+ ConfigObject
is a tree of nested maps from keys to values.
+
+
+ Use ConfigUtil.joinPath(java.lang.String...)
and ConfigUtil.splitPath(java.lang.String)
to convert
+ between path expressions and individual path elements (keys).
+
+
+ Another difference between Config
and ConfigObject
is that
+ conceptually, ConfigValue
s with a valueType()
of NULL
exist in a
+ ConfigObject
, while a Config
treats null values as if they
+ were missing.
+
+
+ Config
is an immutable object and thus safe to use from multiple
+ threads. There's never a need for "defensive copies."
+
+
+ The "getters" on a Config
all work in the same way. They never return
+ null, nor do they return a ConfigValue
with
+ valueType()
of NULL
. Instead, they throw ConfigException.Missing
if the value is
+ completely absent or set to null. If the value is set to null, a subtype of
+ ConfigException.Missing
called ConfigException.Null
will be
+ thrown. ConfigException.WrongType
will be thrown anytime you ask for
+ a type and the value has an incompatible type. Reasonable type conversions
+ are performed for you though.
+
+
+ If you want to iterate over the contents of a Config
, you can get its
+ ConfigObject
with root()
, and then iterate over the
+ ConfigObject
(which implements java.util.Map
). Or, you
+ can use entrySet()
which recurses the object tree for you and builds
+ up a Set
of all path-value pairs where the value is not null.
+
+
+ Do not implement Config
; it should only be implemented by
+ the config library. Arbitrary implementations will not work because the
+ library internals assume a specific concrete implementation. Also, this
+ interface is likely to grow new methods over time, so third-party
+ implementations will break.
+
+ +
+
+Method Summary | +|
---|---|
+ Config |
+atKey(String key)
+
++ Places the config inside a Config at the given key. |
+
+ Config |
+atPath(String path)
+
++ Places the config inside another Config at the given path. |
+
+ void |
+checkValid(Config reference,
+ String... restrictToPaths)
+
++ Validates this config against a reference config, throwing an exception + if it is invalid. |
+
+ Set<Map.Entry<String,ConfigValue>> |
+entrySet()
+
++ Returns the set of path-value pairs, excluding any null values, found by + recursing the root object . |
+
+ Object |
+getAnyRef(String path)
+
++ Gets the value at the path as an unwrapped Java boxed value ( + Boolean , Integer , and
+ so on - see ConfigValue.unwrapped() ). |
+
+ List<? extends Object> |
+getAnyRefList(String path)
+
++ |
+
+ boolean |
+getBoolean(String path)
+
++ |
+
+ List<Boolean> |
+getBooleanList(String path)
+
++ |
+
+ Long |
+getBytes(String path)
+
++ Gets a value as a size in bytes (parses special strings like "128M"). |
+
+ List<Long> |
+getBytesList(String path)
+
++ |
+
+ Config |
+getConfig(String path)
+
++ |
+
+ List<? extends Config> |
+getConfigList(String path)
+
++ |
+
+ double |
+getDouble(String path)
+
++ |
+
+ List<Double> |
+getDoubleList(String path)
+
++ |
+
+ int |
+getInt(String path)
+
++ |
+
+ List<Integer> |
+getIntList(String path)
+
++ |
+
+ ConfigList |
+getList(String path)
+
++ Gets a list value (with any element type) as a ConfigList , which
+ implements java.util.List<ConfigValue> . |
+
+ long |
+getLong(String path)
+
++ |
+
+ List<Long> |
+getLongList(String path)
+
++ |
+
+ Long |
+getMilliseconds(String path)
+
++ Get value as a duration in milliseconds. |
+
+ List<Long> |
+getMillisecondsList(String path)
+
++ |
+
+ Long |
+getNanoseconds(String path)
+
++ Get value as a duration in nanoseconds. |
+
+ List<Long> |
+getNanosecondsList(String path)
+
++ |
+
+ Number |
+getNumber(String path)
+
++ |
+
+ List<Number> |
+getNumberList(String path)
+
++ |
+
+ ConfigObject |
+getObject(String path)
+
++ |
+
+ List<? extends ConfigObject> |
+getObjectList(String path)
+
++ |
+
+ String |
+getString(String path)
+
++ |
+
+ List<String> |
+getStringList(String path)
+
++ |
+
+ ConfigValue |
+getValue(String path)
+
++ Gets the value at the given path, unless the value is a + null value or missing, in which case it throws just like + the other getters. |
+
+ boolean |
+hasPath(String path)
+
++ Checks whether a value is present and non-null at the given path. |
+
+ boolean |
+isEmpty()
+
++ Returns true if the Config 's root object contains no key-value
+ pairs. |
+
+ ConfigOrigin |
+origin()
+
++ Gets the origin of the Config , which may be a file, or a file
+ with a line number, or just a descriptive phrase. |
+
+ Config |
+resolve()
+
++ Returns a replacement config with all substitutions (the + ${foo.bar} syntax, see the
+ spec) resolved. |
+
+ Config |
+resolve(ConfigResolveOptions options)
+
++ Like resolve() but allows you to specify non-default
+ options. |
+
+ ConfigObject |
+root()
+
++ Gets the Config as a tree of ConfigObject . |
+
+ Config |
+withFallback(ConfigMergeable other)
+
++ Returns a new value computed by merging this value with another, with + keys in this value "winning" over the other one. |
+
+ Config |
+withOnlyPath(String path)
+
++ Clone the config with only the given path (and its children) retained; + all sibling paths are removed. |
+
+ Config |
+withoutPath(String path)
+
++ Clone the config with the given path removed. |
+
+ Config |
+withValue(String path,
+ ConfigValue value)
+
++ Returns a Config based on this one, but with the given path set
+ to the given value. |
+
+Method Detail | +
---|
+ConfigObject root()+
Config
as a tree of ConfigObject
. This is a
+ constant-time operation (it is not proportional to the number of values
+ in the Config
).
++
+ConfigOrigin origin()+
Config
, which may be a file, or a file
+ with a line number, or just a descriptive phrase.
++
Config
for use in error messages+Config withFallback(ConfigMergeable other)+
ConfigMergeable
ConfigObject
and Config
instances do anything in this
+ method (they need to merge the fallback keys into themselves). All other
+ values just return the original value, since they automatically override
+ any fallback.
+
+ + The semantics of merging are described in the spec + for HOCON. + +
+ Note that objects do not merge "across" non-objects; if you write
+ object.withFallback(nonObject).withFallback(otherObject)
,
+ then otherObject
will simply be ignored. This is an
+ intentional part of how merging works. Both non-objects, and any object
+ which has fallen back to a non-object, block subsequent fallbacks.
+
+
withFallback
in interface ConfigMergeable
other
- an object whose keys should be used if the keys are not
+ present in this one
++Config resolve()+
${foo.bar}
syntax, see the
+ spec) resolved. Substitutions are looked up using this
+ Config
as the root object, that is, a substitution
+ ${foo.bar}
will be replaced with the result of
+ getValue("foo.bar")
.
+
+
+ This method uses ConfigResolveOptions.defaults()
, there is
+ another variant resolve(ConfigResolveOptions)
which lets
+ you specify non-default options.
+
+
+ A given Config
must be resolved before using it to retrieve
+ config values, but ideally should be resolved one time for your entire
+ stack of fallbacks (see withFallback(com.typesafe.config.ConfigMergeable)
). Otherwise, some
+ substitutions that could have resolved with all fallbacks available may
+ not resolve, which will be a user-visible oddity.
+
+
+ resolve()
should be invoked on root config objects, rather
+ than on a subtree (a subtree is the result of something like
+ config.getConfig("foo")
). The problem with
+ resolve()
on a subtree is that substitutions are relative to
+ the root of the config and the subtree will have no way to get values
+ from the root. For example, if you did
+ config.getConfig("foo").resolve()
on the below config file,
+ it would not work:
+
+
+ common-value = 10 + foo { + whatever = ${common-value} + } ++
+
ConfigException.UnresolvedSubstitution
- if any substitutions refer to nonexistent paths
+ConfigException
- some other config exception if there are other problems+Config resolve(ConfigResolveOptions options)+
resolve()
but allows you to specify non-default
+ options.
++
options
- resolve options
+Config
+void checkValid(Config reference, + String... restrictToPaths)+
+ Using this method is always optional, since you can "fail late" instead. + +
+ You must restrict validation to paths you "own" (those whose meaning are + defined by your code module). If you validate globally, you may trigger + errors about paths that happen to be in the config but have nothing to do + with your module. It's best to allow the modules owning those paths to + validate them. Also, if every module validates only its own stuff, there + isn't as much redundant work being done. + +
+ If no paths are specified in checkValid()
's parameter list,
+ validation is for the entire config.
+
+
+ If you specify paths that are not in the reference config, those paths + are ignored. (There's nothing to validate.) + +
+ Here's what validation involves: + +
getMilliseconds(java.lang.String)
). Also,
+ it's allowed to set any type to null or override null with any type.
+ + If you want to allow a certain setting to have a flexible type (or + otherwise want validation to be looser for some settings), you could + either remove the problematic setting from the reference config provided + to this method, or you could intercept the validation exception and + screen out certain problems. Of course, this will only work if all other + callers of this method are careful to restrict validation to their own + paths, as they should be. + +
+ If validation fails, the thrown exception contains a list of all problems
+ found. See ConfigException.ValidationFailed.problems
. The
+ exception's getMessage()
will have all the problems
+ concatenated into one huge string, as well.
+
+
+ Again, checkValid()
can't guess every domain-specific way a
+ setting can be invalid, so some problems may arise later when attempting
+ to use the config. checkValid()
is limited to reporting
+ generic, but common, problems such as missing settings and blatant type
+ incompatibilities.
+
+
reference
- a reference configurationrestrictToPaths
- only validate values underneath these paths that your code
+ module owns and understands
+ConfigException.ValidationFailed
- if there are any validation issues
+ConfigException.NotResolved
- if this config is not resolved
+ConfigException.BugOrBroken
- if the reference config is unresolved or caller otherwise
+ misuses the API+boolean hasPath(String path)+
Map.containsKey()
as implemented by
+ ConfigObject
: it looks for a path expression, not a key; and it
+ returns false for null values, while containsKey()
returns true
+ indicating that the object contains a null value for the key.
+
+
+ If a path exists according to hasPath(String)
, then
+ getValue(String)
will never throw an exception. However, the
+ typed getters, such as getInt(String)
, will still throw if the
+ value is not convertible to the requested type.
+
+
path
- the path expression
+ConfigException.BadPath
- if the path expression is invalid+boolean isEmpty()+
Config
's root object contains no key-value
+ pairs.
++
+Set<Map.Entry<String,ConfigValue>> entrySet()+
the root object
. Note that this is very
+ different from root().entrySet()
which returns the set of
+ immediate-child keys in the root object and includes null values.
++
ConfigObject
+boolean getBoolean(String path)+
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to boolean+Number getNumber(String path)+
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to a number+int getInt(String path)+
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to an int (for example it is out
+ of range, or it's a boolean value)+long getLong(String path)+
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to a long+double getDouble(String path)+
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to a double+String getString(String path)+
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to a string+ConfigObject getObject(String path)+
path
- path expression
+ConfigObject
value at the requested path
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to an object+Config getConfig(String path)+
path
- path expression
+Config
value at the requested path
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to a Config+Object getAnyRef(String path)+
Boolean
, Integer
, and
+ so on - see ConfigValue.unwrapped()
).
++
path
- path expression
+ConfigException.Missing
- if value is absent or null+ConfigValue getValue(String path)+
get()
on the root()
object (or other object in the tree) if you
+ want an unprocessed value.
++
path
- path expression
+ConfigException.Missing
- if value is absent or null+Long getBytes(String path)+
+
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to Long or String
+ConfigException.BadValue
- if value cannot be parsed as a size in bytes+Long getMilliseconds(String path)+
+
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to Long or String
+ConfigException.BadValue
- if value cannot be parsed as a number of milliseconds+Long getNanoseconds(String path)+
getMilliseconds(String)
.
++
path
- path expression
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to Long or String
+ConfigException.BadValue
- if value cannot be parsed as a number of nanoseconds+ConfigList getList(String path)+
ConfigList
, which
+ implements java.util.List<ConfigValue>
. Throws if the path is
+ unset or null.
++
path
- the path to the list value.
+ConfigList
at the path
+ConfigException.Missing
- if value is absent or null
+ConfigException.WrongType
- if value is not convertible to a ConfigList+List<Boolean> getBooleanList(String path)+
+List<Number> getNumberList(String path)+
+List<Integer> getIntList(String path)+
+List<Long> getLongList(String path)+
+List<Double> getDoubleList(String path)+
+List<String> getStringList(String path)+
+List<? extends ConfigObject> getObjectList(String path)+
+List<? extends Config> getConfigList(String path)+
+List<? extends Object> getAnyRefList(String path)+
+List<Long> getBytesList(String path)+
+List<Long> getMillisecondsList(String path)+
+List<Long> getNanosecondsList(String path)+
+Config withOnlyPath(String path)+
+
path
- path to keep
++Config withoutPath(String path)+
+
path
- path to remove
++Config atPath(String path)+
Config
at the given path.
++
path
- path to store this config at.
+Config
instance containing this config at the given
+ path.+Config atKey(String key)+
Config
at the given key. See also
+ atPath().
++
key
- key to store this config at.
+Config
instance containing this config at the given
+ key.+Config withValue(String path, + ConfigValue value)+
Config
based on this one, but with the given path set
+ to the given value. Does not modify this instance (since it's immutable).
+ If the path already has a value, that value is replaced. To remove a
+ value, use withoutPath().
++
path
- path to addvalue
- value at the new path
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.BadPath +
public static class ConfigException.BadPath
+Exception indicating that a path expression was invalid. Try putting + double quotes around path elements that contain "special" characters. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.BadPath(ConfigOrigin origin,
+ String message)
+
++ |
+|
ConfigException.BadPath(ConfigOrigin origin,
+ String path,
+ String message)
+
++ |
+|
ConfigException.BadPath(ConfigOrigin origin,
+ String path,
+ String message,
+ Throwable cause)
+
++ |
+|
ConfigException.BadPath(String path,
+ String message)
+
++ |
+|
ConfigException.BadPath(String path,
+ String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.BadPath(ConfigOrigin origin, + String path, + String message, + Throwable cause)+
+public ConfigException.BadPath(ConfigOrigin origin, + String path, + String message)+
+public ConfigException.BadPath(String path, + String message, + Throwable cause)+
+public ConfigException.BadPath(String path, + String message)+
+public ConfigException.BadPath(ConfigOrigin origin, + String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.BadValue +
public static class ConfigException.BadValue
+Exception indicating that a value was messed up, for example you may have + asked for a duration and the value can't be sensibly parsed as a + duration. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.BadValue(ConfigOrigin origin,
+ String path,
+ String message)
+
++ |
+|
ConfigException.BadValue(ConfigOrigin origin,
+ String path,
+ String message,
+ Throwable cause)
+
++ |
+|
ConfigException.BadValue(String path,
+ String message)
+
++ |
+|
ConfigException.BadValue(String path,
+ String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.BadValue(ConfigOrigin origin, + String path, + String message, + Throwable cause)+
+public ConfigException.BadValue(ConfigOrigin origin, + String path, + String message)+
+public ConfigException.BadValue(String path, + String message, + Throwable cause)+
+public ConfigException.BadValue(String path, + String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.BugOrBroken +
public static class ConfigException.BugOrBroken
+Exception indicating that there's a bug in something (possibly the + library itself) or the runtime environment is broken. This exception + should never be handled; instead, something should be fixed to keep the + exception from occurring. This exception can be thrown by any method in + the library. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.BugOrBroken(String message)
+
++ |
+|
ConfigException.BugOrBroken(String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.BugOrBroken(String message, + Throwable cause)+
+public ConfigException.BugOrBroken(String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.Generic +
public static class ConfigException.Generic
+Exception that doesn't fall into any other category. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.Generic(String message)
+
++ |
+|
ConfigException.Generic(String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.Generic(String message, + Throwable cause)+
+public ConfigException.Generic(String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.IO +
public static class ConfigException.IO
+Exception indicating that there was an IO error. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.IO(ConfigOrigin origin,
+ String message)
+
++ |
+|
ConfigException.IO(ConfigOrigin origin,
+ String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.IO(ConfigOrigin origin, + String message, + Throwable cause)+
+public ConfigException.IO(ConfigOrigin origin, + String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.Missing +
public static class ConfigException.Missing
+Exception indicates that the setting was never set to anything, not even + null. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
+protected |
+ConfigException.Missing(ConfigOrigin origin,
+ String message)
+
++ |
+
+protected |
+ConfigException.Missing(ConfigOrigin origin,
+ String message,
+ Throwable cause)
+
++ |
+
+ |
+ConfigException.Missing(String path)
+
++ |
+
+ |
+ConfigException.Missing(String path,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.Missing(String path, + Throwable cause)+
+public ConfigException.Missing(String path)+
+protected ConfigException.Missing(ConfigOrigin origin, + String message, + Throwable cause)+
+protected ConfigException.Missing(ConfigOrigin origin, + String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.BugOrBroken +
com.typesafe.config.ConfigException.NotResolved +
public static class ConfigException.NotResolved
+Exception indicating that you tried to use a function that requires
+ substitutions to be resolved, but substitutions have not been resolved
+ (that is, Config.resolve()
was not called). This is always a bug in
+ either application code or the library; it's wrong to write a handler for
+ this exception because you should be able to fix the code to avoid it by
+ adding calls to Config.resolve()
.
+
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.NotResolved(String message)
+
++ |
+|
ConfigException.NotResolved(String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.NotResolved(String message, + Throwable cause)+
+public ConfigException.NotResolved(String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.Missing +
com.typesafe.config.ConfigException.Null +
public static class ConfigException.Null
+Exception indicates that the setting was treated as missing because it + was set to null. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.Null(ConfigOrigin origin,
+ String path,
+ String expected)
+
++ |
+|
ConfigException.Null(ConfigOrigin origin,
+ String path,
+ String expected,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.Null(ConfigOrigin origin, + String path, + String expected, + Throwable cause)+
+public ConfigException.Null(ConfigOrigin origin, + String path, + String expected)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.Parse +
public static class ConfigException.Parse
+Exception indicating that there was a parse error. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.Parse(ConfigOrigin origin,
+ String message)
+
++ |
+|
ConfigException.Parse(ConfigOrigin origin,
+ String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.Parse(ConfigOrigin origin, + String message, + Throwable cause)+
+public ConfigException.Parse(ConfigOrigin origin, + String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.Parse +
com.typesafe.config.ConfigException.UnresolvedSubstitution +
public static class ConfigException.UnresolvedSubstitution
+Exception indicating that a substitution did not resolve to anything.
+ Thrown by Config.resolve()
.
+
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.UnresolvedSubstitution(ConfigOrigin origin,
+ String detail)
+
++ |
+|
ConfigException.UnresolvedSubstitution(ConfigOrigin origin,
+ String detail,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.UnresolvedSubstitution(ConfigOrigin origin, + String detail, + Throwable cause)+
+public ConfigException.UnresolvedSubstitution(ConfigOrigin origin, + String detail)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.ValidationFailed +
public static class ConfigException.ValidationFailed
+Exception indicating that Config.checkValid(com.typesafe.config.Config, java.lang.String...)
found validity
+ problems. The problems are available via the problems()
method.
+ The getMessage()
of this exception is a potentially very
+ long string listing all the problems found.
+
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.ValidationFailed(Iterable<ConfigException.ValidationProblem> problems)
+
++ |
+
+Method Summary | +|
---|---|
+ Iterable<ConfigException.ValidationProblem> |
+problems()
+
++ |
+
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.ValidationFailed(Iterable<ConfigException.ValidationProblem> problems)+
+Method Detail | +
---|
+public Iterable<ConfigException.ValidationProblem> problems()+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++com.typesafe.config.ConfigException.ValidationProblem +
public static class ConfigException.ValidationProblem
+Information about a problem that occurred in Config.checkValid(com.typesafe.config.Config, java.lang.String...)
. A
+ ConfigException.ValidationFailed
exception thrown from
+ checkValid()
includes a list of problems encountered.
+
+ +
+
+Constructor Summary | +|
---|---|
ConfigException.ValidationProblem(String path,
+ ConfigOrigin origin,
+ String problem)
+
++ |
+
+Method Summary | +|
---|---|
+ ConfigOrigin |
+origin()
+
++ Returns where the problem occurred (origin may include info on the + file, line number, etc.). |
+
+ String |
+path()
+
++ Returns the config setting causing the problem. |
+
+ String |
+problem()
+
++ Returns a description of the problem. |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.ValidationProblem(String path, + ConfigOrigin origin, + String problem)+
+Method Detail | +
---|
+public String path()+
+
+public ConfigOrigin origin()+
+
+public String problem()+
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
com.typesafe.config.ConfigException.WrongType +
public static class ConfigException.WrongType
+Exception indicating that the type of a value does not match the type you + requested. +
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from class com.typesafe.config.ConfigException | +
---|
ConfigException.BadPath, ConfigException.BadValue, ConfigException.BugOrBroken, ConfigException.Generic, ConfigException.IO, ConfigException.Missing, ConfigException.NotResolved, ConfigException.Null, ConfigException.Parse, ConfigException.UnresolvedSubstitution, ConfigException.ValidationFailed, ConfigException.ValidationProblem, ConfigException.WrongType |
+
+Constructor Summary | +|
---|---|
ConfigException.WrongType(ConfigOrigin origin,
+ String message)
+
++ |
+|
ConfigException.WrongType(ConfigOrigin origin,
+ String path,
+ String expected,
+ String actual)
+
++ |
+|
ConfigException.WrongType(ConfigOrigin origin,
+ String path,
+ String expected,
+ String actual,
+ Throwable cause)
+
++ |
+|
ConfigException.WrongType(ConfigOrigin origin,
+ String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +
---|
Methods inherited from class com.typesafe.config.ConfigException | +
---|
origin |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+public ConfigException.WrongType(ConfigOrigin origin, + String path, + String expected, + String actual, + Throwable cause)+
+public ConfigException.WrongType(ConfigOrigin origin, + String path, + String expected, + String actual)+
+public ConfigException.WrongType(ConfigOrigin origin, + String message, + Throwable cause)+
+public ConfigException.WrongType(ConfigOrigin origin, + String message)+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++java.lang.Throwable +
java.lang.Exception +
java.lang.RuntimeException +
com.typesafe.config.ConfigException +
public abstract class ConfigException
+All exceptions thrown by the library are subclasses of
+ ConfigException
.
+
+ +
+
+Nested Class Summary | +|
---|---|
+static class |
+ConfigException.BadPath
+
++ Exception indicating that a path expression was invalid. |
+
+static class |
+ConfigException.BadValue
+
++ Exception indicating that a value was messed up, for example you may have + asked for a duration and the value can't be sensibly parsed as a + duration. |
+
+static class |
+ConfigException.BugOrBroken
+
++ Exception indicating that there's a bug in something (possibly the + library itself) or the runtime environment is broken. |
+
+static class |
+ConfigException.Generic
+
++ Exception that doesn't fall into any other category. |
+
+static class |
+ConfigException.IO
+
++ Exception indicating that there was an IO error. |
+
+static class |
+ConfigException.Missing
+
++ Exception indicates that the setting was never set to anything, not even + null. |
+
+static class |
+ConfigException.NotResolved
+
++ Exception indicating that you tried to use a function that requires + substitutions to be resolved, but substitutions have not been resolved + (that is, Config.resolve() was not called). |
+
+static class |
+ConfigException.Null
+
++ Exception indicates that the setting was treated as missing because it + was set to null. |
+
+static class |
+ConfigException.Parse
+
++ Exception indicating that there was a parse error. |
+
+static class |
+ConfigException.UnresolvedSubstitution
+
++ Exception indicating that a substitution did not resolve to anything. |
+
+static class |
+ConfigException.ValidationFailed
+
++ Exception indicating that Config.checkValid(com.typesafe.config.Config, java.lang.String...) found validity
+ problems. |
+
+static class |
+ConfigException.ValidationProblem
+
++ Information about a problem that occurred in Config.checkValid(com.typesafe.config.Config, java.lang.String...) . |
+
+static class |
+ConfigException.WrongType
+
++ Exception indicating that the type of a value does not match the type you + requested. |
+
+Constructor Summary | +|
---|---|
+protected |
+ConfigException(ConfigOrigin origin,
+ String message)
+
++ |
+
+protected |
+ConfigException(ConfigOrigin origin,
+ String message,
+ Throwable cause)
+
++ |
+
+protected |
+ConfigException(String message)
+
++ |
+
+protected |
+ConfigException(String message,
+ Throwable cause)
+
++ |
+
+Method Summary | +|
---|---|
+ ConfigOrigin |
+origin()
+
++ Returns an "origin" (such as a filename and line number) for the + exception, or null if none is available. |
+
Methods inherited from class java.lang.Throwable | +
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Constructor Detail | +
---|
+protected ConfigException(ConfigOrigin origin, + String message, + Throwable cause)+
+protected ConfigException(ConfigOrigin origin, + String message)+
+protected ConfigException(String message, + Throwable cause)+
+protected ConfigException(String message)+
+Method Detail | +
---|
+public ConfigOrigin origin()+
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++com.typesafe.config.ConfigFactory +
public final class ConfigFactory
+Contains static methods for creating Config
instances.
+
+
+ See also ConfigValueFactory
which contains static methods for
+ converting Java values into a ConfigObject
. You can then convert a
+ ConfigObject
into a Config
with ConfigObject.toConfig()
.
+
+
+ The static methods with "load" in the name do some sort of higher-level
+ operation potentially parsing multiple resources and resolving substitutions,
+ while the ones with "parse" in the name just create a ConfigValue
+ from a resource and nothing else.
+
+ +
+
+Method Summary | +|
---|---|
+static Config |
+defaultOverrides()
+
++ Obtains the default override configuration, which currently consists of + system properties. |
+
+static Config |
+defaultOverrides(ClassLoader loader)
+
++ Like defaultOverrides() but allows you to specify a class loader
+ to use rather than the current context class loader. |
+
+static Config |
+defaultReference()
+
++ Obtains the default reference configuration, which is currently created + by merging all resources "reference.conf" found on the classpath and + overriding the result with system properties. |
+
+static Config |
+defaultReference(ClassLoader loader)
+
++ Like defaultReference() but allows you to specify a class loader
+ to use rather than the current context class loader. |
+
+static Config |
+empty()
+
++ Gets an empty configuration. |
+
+static Config |
+empty(String originDescription)
+
++ Gets an empty configuration with a description to be used to create a + ConfigOrigin for this Config . |
+
+static void |
+invalidateCaches()
+
++ Reloads any cached configs, picking up changes to system properties for + example. |
+
+static Config |
+load()
+
++ Loads a default configuration, equivalent to load("application") in most cases. |
+
+static Config |
+load(ClassLoader loader)
+
++ Like load() but allows specifying a class loader other than the
+ thread's current context class loader. |
+
+static Config |
+load(ClassLoader loader,
+ Config config)
+
++ |
+
+static Config |
+load(ClassLoader loader,
+ Config config,
+ ConfigResolveOptions resolveOptions)
+
++ Like load(Config,ConfigResolveOptions) but allows you to specify
+ a class loader other than the context class loader. |
+
+static Config |
+load(ClassLoader loader,
+ ConfigParseOptions parseOptions)
+
++ Like load() but allows specifying a class loader other than the
+ thread's current context class loader, and parse options |
+
+static Config |
+load(ClassLoader loader,
+ ConfigParseOptions parseOptions,
+ ConfigResolveOptions resolveOptions)
+
++ Like load() but allows specifying a class loader other than the
+ thread's current context class loader, parse options, and resolve options |
+
+static Config |
+load(ClassLoader loader,
+ ConfigResolveOptions resolveOptions)
+
++ Like load() but allows specifying a class loader other than the
+ thread's current context class loader, and resolve options |
+
+static Config |
+load(ClassLoader loader,
+ String resourceBasename)
+
++ Like load(String) but uses the supplied class loader instead of
+ the current thread's context class loader. |
+
+static Config |
+load(ClassLoader loader,
+ String resourceBasename,
+ ConfigParseOptions parseOptions,
+ ConfigResolveOptions resolveOptions)
+
++ Like load(String,ConfigParseOptions,ConfigResolveOptions) but
+ has a class loader parameter that overrides any from the
+ ConfigParseOptions . |
+
+static Config |
+load(Config config)
+
++ Assembles a standard configuration using a custom Config
+ object rather than loading "application.conf". |
+
+static Config |
+load(Config config,
+ ConfigResolveOptions resolveOptions)
+
++ Like load(Config) but allows you to specify
+ ConfigResolveOptions . |
+
+static Config |
+load(ConfigParseOptions parseOptions)
+
++ Like load() but allows specifying parse options |
+
+static Config |
+load(String resourceBasename)
+
++ Loads an application's configuration from the given classpath resource or + classpath resource basename, sandwiches it between default reference + config and default overrides, and then resolves it. |
+
+static Config |
+load(String resourceBasename,
+ ConfigParseOptions parseOptions,
+ ConfigResolveOptions resolveOptions)
+
++ Like load(String) but allows you to specify parse and resolve
+ options. |
+
+static Config |
+parseFile(File file)
+
++ |
+
+static Config |
+parseFile(File file,
+ ConfigParseOptions options)
+
++ |
+
+static Config |
+parseFileAnySyntax(File fileBasename)
+
++ |
+
+static Config |
+parseFileAnySyntax(File fileBasename,
+ ConfigParseOptions options)
+
++ Parses a file with a flexible extension. |
+
+static Config |
+parseMap(Map<String,? extends Object> values)
+
++ See the other overload of parseMap(Map, String) for details,
+ this one just uses a default origin description. |
+
+static Config |
+parseMap(Map<String,? extends Object> values,
+ String originDescription)
+
++ Creates a Config based on a Map from paths to
+ plain Java values. |
+
+static Config |
+parseProperties(Properties properties)
+
++ |
+
+static Config |
+parseProperties(Properties properties,
+ ConfigParseOptions options)
+
++ Converts a Java Properties object to a
+ ConfigObject using the rules documented in the HOCON
+ spec. |
+
+static Config |
+parseReader(Reader reader)
+
++ |
+
+static Config |
+parseReader(Reader reader,
+ ConfigParseOptions options)
+
++ |
+
+static Config |
+parseResources(Class<?> klass,
+ String resource)
+
++ |
+
+static Config |
+parseResources(Class<?> klass,
+ String resource,
+ ConfigParseOptions options)
+
++ Parses all resources on the classpath with the given name and merges them + into a single Config . |
+
+static Config |
+parseResources(ClassLoader loader,
+ String resource)
+
++ |
+
+static Config |
+parseResources(ClassLoader loader,
+ String resource,
+ ConfigParseOptions options)
+
++ Parses all resources on the classpath with the given name and merges them + into a single Config . |
+
+static Config |
+parseResources(String resource)
+
++ Like parseResources(ClassLoader,String) but uses thread's
+ current context class loader. |
+
+static Config |
+parseResources(String resource,
+ ConfigParseOptions options)
+
++ Like parseResources(ClassLoader,String,ConfigParseOptions) but
+ uses thread's current context class loader. |
+
+static Config |
+parseResourcesAnySyntax(Class<?> klass,
+ String resourceBasename)
+
++ |
+
+static Config |
+parseResourcesAnySyntax(Class<?> klass,
+ String resourceBasename,
+ ConfigParseOptions options)
+
++ Parses classpath resources with a flexible extension. |
+
+static Config |
+parseResourcesAnySyntax(ClassLoader loader,
+ String resourceBasename)
+
++ |
+
+static Config |
+parseResourcesAnySyntax(ClassLoader loader,
+ String resourceBasename,
+ ConfigParseOptions options)
+
++ Parses classpath resources with a flexible extension. |
+
+static Config |
+parseResourcesAnySyntax(String resourceBasename)
+
++ Like parseResourcesAnySyntax(ClassLoader,String) but uses
+ thread's current context class loader. |
+
+static Config |
+parseResourcesAnySyntax(String resourceBasename,
+ ConfigParseOptions options)
+
++ Like + parseResourcesAnySyntax(ClassLoader,String,ConfigParseOptions)
+ but uses thread's current context class loader. |
+
+static Config |
+parseString(String s)
+
++ |
+
+static Config |
+parseString(String s,
+ ConfigParseOptions options)
+
++ |
+
+static Config |
+parseURL(URL url)
+
++ |
+
+static Config |
+parseURL(URL url,
+ ConfigParseOptions options)
+
++ |
+
+static Config |
+systemEnvironment()
+
++ Gets a Config containing the system's environment variables. |
+
+static Config |
+systemProperties()
+
++ Gets a Config containing the system properties from
+ System.getProperties() , parsed and converted as with
+ parseProperties(java.util.Properties, com.typesafe.config.ConfigParseOptions) . |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Method Detail | +
---|
+public static Config load(String resourceBasename)+
ClassLoader.getResource(java.lang.String)
not
+ Class.getResource(java.lang.String)
).
+
+
+ Resources are loaded from the current thread's
+ Thread.getContextClassLoader()
. In general, a library needs its
+ configuration to come from the class loader used to load that library, so
+ the proper "reference.conf" are present.
+
+
+ The loaded object will already be resolved (substitutions have already
+ been processed). As a result, if you add more fallbacks then they won't
+ be seen by substitutions. Substitutions are the "${foo.bar}" syntax. If
+ you want to parse additional files or something then you need to use
+ load(Config)
.
+
+
resourceBasename
- name (optionally without extension) of a resource on classpath
++public static Config load(ClassLoader loader, + String resourceBasename)+
load(String)
but uses the supplied class loader instead of
+ the current thread's context class loader.
++
loader
- resourceBasename
-
++public static Config load(String resourceBasename, + ConfigParseOptions parseOptions, + ConfigResolveOptions resolveOptions)+
load(String)
but allows you to specify parse and resolve
+ options.
++
resourceBasename
- the classpath resource name with optional extensionparseOptions
- options to use when parsing the resourceresolveOptions
- options to use when resolving the stack
++public static Config load(ClassLoader loader, + String resourceBasename, + ConfigParseOptions parseOptions, + ConfigResolveOptions resolveOptions)+
load(String,ConfigParseOptions,ConfigResolveOptions)
but
+ has a class loader parameter that overrides any from the
+ ConfigParseOptions
.
++
loader
- class loader in which to find resources (overrides loader in
+ parse options)resourceBasename
- the classpath resource name with optional extensionparseOptions
- options to use when parsing the resource (class loader
+ overridden)resolveOptions
- options to use when resolving the stack
++public static Config load(Config config)+
Config
+ object rather than loading "application.conf". The Config
+ object will be sandwiched between the default reference config and
+ default overrides and then resolved.
++
config
- the application's portion of the configuration
++public static Config load(ClassLoader loader, + Config config)+
+public static Config load(Config config, + ConfigResolveOptions resolveOptions)+
load(Config)
but allows you to specify
+ ConfigResolveOptions
.
++
config
- the application's portion of the configurationresolveOptions
- options for resolving the assembled config stack
++public static Config load(ClassLoader loader, + Config config, + ConfigResolveOptions resolveOptions)+
load(Config,ConfigResolveOptions)
but allows you to specify
+ a class loader other than the context class loader.
++
loader
- class loader to use when looking up override and reference
+ configsconfig
- the application's portion of the configurationresolveOptions
- options for resolving the assembled config stack
++public static Config load()+
load("application")
in most cases. This configuration should be used by
+ libraries and frameworks unless an application provides a different one.
+
+ This method may return a cached singleton so will not see changes to
+ system properties or config files. (Use invalidateCaches()
to
+ force it to reload.)
+
+ If the system properties config.resource
,
+ config.file
, or config.url
are set, then the
+ classpath resource, file, or URL specified in those properties will be
+ used rather than the default
+ application.{conf,json,properties}
classpath resources.
+ These system properties should not be set in code (after all, you can
+ just parse whatever you want manually and then use load(Config)
+ if you don't want to use application.conf
). The properties
+ are intended for use by the person or script launching the application.
+ For example someone might have a production.conf
that
+ include application.conf
but then change a couple of values.
+ When launching the app they could specify
+ -Dconfig.resource=production.conf
to get production mode.
+
+ If no system properties are set to change the location of the default
+ configuration, ConfigFactory.load()
is equivalent to
+ ConfigFactory.load("application")
.
+
+
+public static Config load(ConfigParseOptions parseOptions)+
load()
but allows specifying parse options
++
parseOptions
- Options for parsing resources
++public static Config load(ClassLoader loader)+
load()
but allows specifying a class loader other than the
+ thread's current context class loader.
++
loader
- class loader for finding resources
++public static Config load(ClassLoader loader, + ConfigParseOptions parseOptions)+
load()
but allows specifying a class loader other than the
+ thread's current context class loader, and parse options
++
loader
- class loader for finding resourcesparseOptions
- Options for parsing resources
++public static Config load(ClassLoader loader, + ConfigResolveOptions resolveOptions)+
load()
but allows specifying a class loader other than the
+ thread's current context class loader, and resolve options
++
loader
- class loader for finding resourcesresolveOptions
- options for resolving the assembled config stack
++public static Config load(ClassLoader loader, + ConfigParseOptions parseOptions, + ConfigResolveOptions resolveOptions)+
load()
but allows specifying a class loader other than the
+ thread's current context class loader, parse options, and resolve options
++
loader
- class loader for finding resourcesparseOptions
- Options for parsing resourcesresolveOptions
- options for resolving the assembled config stack
++public static Config defaultReference()+
+ Libraries and frameworks should ship with a "reference.conf" in their + jar. + +
+ The reference config must be looked up in the class loader that contains
+ the libraries that you want to use with this config, so the
+ "reference.conf" for each library can be found. Use
+ defaultReference(ClassLoader)
if the context class loader is not
+ suitable.
+
+
+ The load()
methods merge this configuration for you
+ automatically.
+
+
+ Future versions may look for reference configuration in more places. It + is not guaranteed that this method only looks at + "reference.conf". +
+
+public static Config defaultReference(ClassLoader loader)+
defaultReference()
but allows you to specify a class loader
+ to use rather than the current context class loader.
++
loader
-
++public static Config defaultOverrides()+
+ The load()
methods merge this configuration for you
+ automatically.
+
+
+ Future versions may get overrides in more places. It is not guaranteed + that this method only uses system properties. +
+
+public static Config defaultOverrides(ClassLoader loader)+
defaultOverrides()
but allows you to specify a class loader
+ to use rather than the current context class loader.
++
loader
-
++public static void invalidateCaches()+
Config
is immutable, anyone with a reference
+ to the old configs will still have the same outdated objects. However,
+ new calls to load()
or defaultOverrides()
or
+ defaultReference()
may return a new object.
+ + This method is primarily intended for use in unit tests, for example, + that may want to update a system property then confirm that it's used + correctly. In many cases, use of this method may indicate there's a + better way to set up your code. +
+ Caches may be reloaded immediately or lazily; once you call this method,
+ the reload can occur at any time, even during the invalidation process.
+ So FIRST make the changes you'd like the caches to notice, then SECOND
+ call this method to invalidate caches. Don't expect that invalidating,
+ making changes, then calling load()
, will work. Make changes
+ before you invalidate.
+
+
+public static Config empty()+
empty(String)
to create an
+ empty configuration with a description, which may improve user-visible
+ error messages.
++
+public static Config empty(String originDescription)+
ConfigOrigin
for this Config
. The description should
+ be very short and say what the configuration is, like "default settings"
+ or "foo settings" or something. (Presumably you will merge some actual
+ settings into this empty config using Config.withFallback(com.typesafe.config.ConfigMergeable)
, making
+ the description more useful.)
++
originDescription
- description of the config
++public static Config systemProperties()+
Config
containing the system properties from
+ System.getProperties()
, parsed and converted as with
+ parseProperties(java.util.Properties, com.typesafe.config.ConfigParseOptions)
.
+ + This method can return a global immutable singleton, so it's preferred + over parsing system properties yourself. +
+ load(java.lang.String)
will include the system properties as overrides already, as
+ will defaultReference()
and defaultOverrides()
.
+
+
+ Because this returns a singleton, it will not notice changes to system
+ properties made after the first time this method is called. Use
+ invalidateCaches()
to force the singleton to reload if you
+ modify system properties.
+
+
Config
+public static Config systemEnvironment()+
Config
containing the system's environment variables.
+ This method can return a global immutable singleton.
+
+
+ Environment variables are used as fallbacks when resolving substitutions
+ whether or not this object is included in the config being resolved, so
+ you probably don't need to use this method for most purposes. It can be a
+ nicer API for accessing environment variables than raw
+ System.getenv(String)
though, since you can use methods
+ such as Config.getInt(java.lang.String)
.
+
+
Config
+public static Config parseProperties(Properties properties, + ConfigParseOptions options)+
Properties
object to a
+ ConfigObject
using the rules documented in the HOCON
+ spec. The keys in the Properties
object are split on the
+ period character '.' and treated as paths. The values will all end up as
+ string values. If you have both "a=foo" and "a.b=bar" in your properties
+ file, so "a" is both the object containing "b" and the string "foo", then
+ the string value is dropped.
+
+
+ If you want to have System.getProperties()
as a
+ ConfigObject, it's better to use the systemProperties()
method
+ which returns a cached global singleton.
+
+
properties
- a Java Properties objectoptions
-
++public static Config parseProperties(Properties properties)+
+public static Config parseReader(Reader reader, + ConfigParseOptions options)+
+public static Config parseReader(Reader reader)+
+public static Config parseURL(URL url, + ConfigParseOptions options)+
+public static Config parseURL(URL url)+
+public static Config parseFile(File file, + ConfigParseOptions options)+
+public static Config parseFile(File file)+
+public static Config parseFileAnySyntax(File fileBasename, + ConfigParseOptions options)+
fileBasename
+ already ends in a known extension, this method parses it according to
+ that extension (the file's syntax must match its extension). If the
+ fileBasename
does not end in an extension, it parses files
+ with all known extensions and merges whatever is found.
+
+
+ In the current implementation, the extension ".conf" forces
+ ConfigSyntax.CONF
, ".json" forces ConfigSyntax.JSON
, and
+ ".properties" forces ConfigSyntax.PROPERTIES
. When merging files,
+ ".conf" falls back to ".json" falls back to ".properties".
+
+
+ Future versions of the implementation may add additional syntaxes or + additional extensions. However, the ordering (fallback priority) of the + three current extensions will remain the same. + +
+ If options
forces a specific syntax, this method only parses
+ files with an extension matching that syntax.
+
+
+ If options.getAllowMissing()
+ is true, then no files have to exist; if false, then at least one file
+ has to exist.
+
+
fileBasename
- a filename with or without extensionoptions
- parse options
++public static Config parseFileAnySyntax(File fileBasename)+
+public static Config parseResources(Class<?> klass, + String resource, + ConfigParseOptions options)+
Config
.
+
+
+ If the resource name does not begin with a "/", it will have the supplied
+ class's package added to it, in the same way as
+ Class.getResource(java.lang.String)
.
+
+
+ Duplicate resources with the same name are merged such that ones returned
+ earlier from ClassLoader.getResources(java.lang.String)
fall back to (have higher
+ priority than) the ones returned later. This implies that resources
+ earlier in the classpath override those later in the classpath when they
+ configure the same setting. However, in practice real applications may
+ not be consistent about classpath ordering, so be careful. It may be best
+ to avoid assuming too much.
+
+
klass
- klass.getClassLoader()
will be used to load
+ resources, and non-absolute resource names will have this
+ class's package addedresource
- resource to look up, relative to klass
's package
+ or absolute starting with a "/"options
- parse options
++public static Config parseResources(Class<?> klass, + String resource)+
+public static Config parseResourcesAnySyntax(Class<?> klass, + String resourceBasename, + ConfigParseOptions options)+
parseFileAnySyntax(File,ConfigParseOptions)
but for classpath
+ resources instead, as in parseResources(java.lang.Class>, java.lang.String, com.typesafe.config.ConfigParseOptions)
.
+
+
+ There is a thorny problem with this method, which is that
+ ClassLoader.getResources(java.lang.String)
must be called separately for
+ each possible extension. The implementation ends up with separate lists
+ of resources called "basename.conf" and "basename.json" for example. As a
+ result, the ideal ordering between two files with different extensions is
+ unknown; there is no way to figure out how to merge the two lists in
+ classpath order. To keep it simple, the lists are simply concatenated,
+ with the same syntax priorities as
+ parseFileAnySyntax()
+ - all ".conf" resources are ahead of all ".json" resources which are
+ ahead of all ".properties" resources.
+
+
klass
- class which determines the ClassLoader
and the
+ package for relative resource namesresourceBasename
- a resource name as in Class.getResource(java.lang.String)
,
+ with or without extensionoptions
- parse options (class loader is ignored in favor of the one
+ from klass)
++public static Config parseResourcesAnySyntax(Class<?> klass, + String resourceBasename)+
+public static Config parseResources(ClassLoader loader, + String resource, + ConfigParseOptions options)+
Config
.
+
+
+ This works like ClassLoader.getResource(java.lang.String)
, not like
+ Class.getResource(java.lang.String)
, so the name never begins with a
+ slash.
+
+
+ See parseResources(Class,String,ConfigParseOptions)
for full
+ details.
+
+
loader
- will be used to load resources by setting this loader on the
+ provided optionsresource
- resource to look upoptions
- parse options (class loader is ignored)
++public static Config parseResources(ClassLoader loader, + String resource)+
+public static Config parseResourcesAnySyntax(ClassLoader loader, + String resourceBasename, + ConfigParseOptions options)+
parseFileAnySyntax(File,ConfigParseOptions)
but for classpath
+ resources instead, as in
+ parseResources(ClassLoader,String,ConfigParseOptions)
.
+
+
+ parseResourcesAnySyntax(Class,String,ConfigParseOptions)
differs
+ in the syntax for the resource name, but otherwise see
+ parseResourcesAnySyntax(Class,String,ConfigParseOptions)
for
+ some details and caveats on this method.
+
+
loader
- class loader to look up resources in, will be set on optionsresourceBasename
- a resource name as in
+ ClassLoader.getResource(java.lang.String)
, with or without
+ extensionoptions
- parse options (class loader ignored)
++public static Config parseResourcesAnySyntax(ClassLoader loader, + String resourceBasename)+
+public static Config parseResources(String resource, + ConfigParseOptions options)+
parseResources(ClassLoader,String,ConfigParseOptions)
but
+ uses thread's current context class loader.
++
+public static Config parseResources(String resource)+
parseResources(ClassLoader,String)
but uses thread's
+ current context class loader.
++
+public static Config parseResourcesAnySyntax(String resourceBasename, + ConfigParseOptions options)+
parseResourcesAnySyntax(ClassLoader,String,ConfigParseOptions)
+ but uses thread's current context class loader.
++
+public static Config parseResourcesAnySyntax(String resourceBasename)+
parseResourcesAnySyntax(ClassLoader,String)
but uses
+ thread's current context class loader.
++
+public static Config parseString(String s, + ConfigParseOptions options)+
+public static Config parseString(String s)+
+public static Config parseMap(Map<String,? extends Object> values, + String originDescription)+
Config
based on a Map
from paths to
+ plain Java values. Similar to
+ ConfigValueFactory.fromMap(Map,String)
, except the keys in the
+ map are path expressions, rather than keys; and correspondingly it
+ returns a Config
instead of a ConfigObject
. This is more
+ convenient if you are writing literal maps in code, and less convenient
+ if you are getting your maps from some data source such as a parser.
+
+ + An exception will be thrown (and it is a bug in the caller of the method) + if a path is both an object and a value, for example if you had both + "a=foo" and "a.b=bar", then "a" is both the string "foo" and the parent + object of "b". The caller of this method should ensure that doesn't + happen. +
+
values
- originDescription
- description of what this map represents, like a filename, or
+ "default settings" (origin description is used in error
+ messages)
+Config
+public static Config parseMap(Map<String,? extends Object> values)+
parseMap(Map, String)
for details,
+ this one just uses a default origin description.
++
values
-
+Config
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigIncludeContext
+Context provided to a ConfigIncluder
; this interface is only useful
+ inside a ConfigIncluder
implementation, and is not intended for apps
+ to implement.
+
+
+ Do not implement this interface; it should only be implemented by + the config library. Arbitrary implementations will not work because the + library internals assume a specific concrete implementation. Also, this + interface is likely to grow new methods over time, so third-party + implementations will break. +
+ +
+
+Method Summary | +|
---|---|
+ ConfigParseOptions |
+parseOptions()
+
++ Parse options to use (if you use another method to get a + ConfigParseable then use ConfigParseable.options()
+ instead though). |
+
+ ConfigParseable |
+relativeTo(String filename)
+
++ Tries to find a name relative to whatever is doing the including, for + example in the same directory as the file doing the including. |
+
+Method Detail | +
---|
+ConfigParseable relativeTo(String filename)+
+
filename
- the name to make relative to the resource doing the including
++ConfigParseOptions parseOptions()+
ConfigParseable
then use ConfigParseable.options()
+ instead though).
++
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigIncluder
+Implement this interface and provide an instance to
+ ConfigParseOptions.setIncluder()
to
+ customize handling of include
statements in config files. You may
+ also want to implement ConfigIncluderClasspath
,
+ ConfigIncluderFile
, and ConfigIncluderURL
, or not.
+
+ +
+
+Method Summary | +|
---|---|
+ ConfigObject |
+include(ConfigIncludeContext context,
+ String what)
+
++ Parses another item to be included. |
+
+ ConfigIncluder |
+withFallback(ConfigIncluder fallback)
+
++ Returns a new includer that falls back to the given includer. |
+
+Method Detail | +
---|
+ConfigIncluder withFallback(ConfigIncluder fallback)+
+
fallback
-
++ConfigObject include(ConfigIncludeContext context, + String what)+
ConfigIncluder
must
+ also implement ConfigIncluderClasspath
,
+ ConfigIncluderFile
, or ConfigIncluderURL
as needed, or a
+ default includer will be used.
++
context
- some info about the include contextwhat
- the include statement's argument
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigIncluderClasspath
+Implement this in addition to ConfigIncluder
if you want to
+ support inclusion of files with the include classpath("resource")
+ syntax. If you do not implement this but do implement ConfigIncluder
,
+ attempts to load classpath resources will use the default includer.
+
+ +
+
+Method Summary | +|
---|---|
+ ConfigObject |
+includeResources(ConfigIncludeContext context,
+ String what)
+
++ Parses another item to be included. |
+
+Method Detail | +
---|
+ConfigObject includeResources(ConfigIncludeContext context, + String what)+
+
context
- some info about the include contextwhat
- the include statement's argument
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigIncluderFile
+Implement this in addition to ConfigIncluder
if you want to
+ support inclusion of files with the include file("filename")
syntax.
+ If you do not implement this but do implement ConfigIncluder
,
+ attempts to load files will use the default includer.
+
+ +
+
+Method Summary | +|
---|---|
+ ConfigObject |
+includeFile(ConfigIncludeContext context,
+ File what)
+
++ Parses another item to be included. |
+
+Method Detail | +
---|
+ConfigObject includeFile(ConfigIncludeContext context, + File what)+
+
context
- some info about the include contextwhat
- the include statement's argument
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigIncluderURL
+Implement this in addition to ConfigIncluder
if you want to
+ support inclusion of files with the include url("http://example.com")
+ syntax. If you do not implement this but do implement ConfigIncluder
,
+ attempts to load URLs will use the default includer.
+
+ +
+
+Method Summary | +|
---|---|
+ ConfigObject |
+includeURL(ConfigIncludeContext context,
+ URL what)
+
++ Parses another item to be included. |
+
+Method Detail | +
---|
+ConfigObject includeURL(ConfigIncludeContext context, + URL what)+
+
context
- some info about the include contextwhat
- the include statement's argument
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigList
+Subtype of ConfigValue
representing a list value, as in JSON's
+ [1,2,3]
syntax.
+
+
+ ConfigList
implements java.util.List<ConfigValue>
so you can
+ use it like a regular Java list. Or call unwrapped()
to unwrap the
+ list elements into plain Java values.
+
+
+ Like all ConfigValue
subtypes, ConfigList
is immutable. This
+ makes it threadsafe and you never have to create "defensive copies." The
+ mutator methods from List
all throw
+ UnsupportedOperationException
.
+
+
+ The ConfigValue.valueType()
method on a list returns
+ ConfigValueType.LIST
.
+
+
+ Do not implement ConfigList
; it should only be implemented
+ by the config library. Arbitrary implementations will not work because the
+ library internals assume a specific concrete implementation. Also, this
+ interface is likely to grow new methods over time, so third-party
+ implementations will break.
+
+ +
+
+Method Summary | +|
---|---|
+ List<Object> |
+unwrapped()
+
++ Recursively unwraps the list, returning a list of plain Java values such + as Integer or String or whatever is in the list. |
+
Methods inherited from interface java.util.List | +
---|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray |
+
Methods inherited from interface com.typesafe.config.ConfigValue | +
---|
atKey, atPath, origin, render, render, valueType, withFallback |
+
+Method Detail | +
---|
+List<Object> unwrapped()+
+
unwrapped
in interface ConfigValue
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigMergeable
+Marker for types whose instances can be merged, that is Config
and
+ ConfigValue
. Instances of Config
and ConfigValue
can
+ be combined into a single new instance using the
+ withFallback()
method.
+
+
+ Do not implement this interface; it should only be implemented by + the config library. Arbitrary implementations will not work because the + library internals assume a specific concrete implementation. Also, this + interface is likely to grow new methods over time, so third-party + implementations will break. +
+ +
+
+Method Summary | +|
---|---|
+ ConfigMergeable |
+withFallback(ConfigMergeable other)
+
++ Returns a new value computed by merging this value with another, with + keys in this value "winning" over the other one. |
+
+Method Detail | +
---|
+ConfigMergeable withFallback(ConfigMergeable other)+
ConfigObject
and Config
instances do anything in this
+ method (they need to merge the fallback keys into themselves). All other
+ values just return the original value, since they automatically override
+ any fallback.
+
+ + The semantics of merging are described in the spec + for HOCON. + +
+ Note that objects do not merge "across" non-objects; if you write
+ object.withFallback(nonObject).withFallback(otherObject)
,
+ then otherObject
will simply be ignored. This is an
+ intentional part of how merging works. Both non-objects, and any object
+ which has fallen back to a non-object, block subsequent fallbacks.
+
+
other
- an object whose keys should be used if the keys are not
+ present in this one
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigObject
+Subtype of ConfigValue
representing an object (dictionary, map)
+ value, as in JSON's { "a" : 42 }
syntax.
+
+
+ ConfigObject
implements java.util.Map<String, ConfigValue>
so
+ you can use it like a regular Java map. Or call unwrapped()
to
+ unwrap the map to a map with plain Java values rather than
+ ConfigValue
.
+
+
+ Like all ConfigValue
subtypes, ConfigObject
is immutable.
+ This makes it threadsafe and you never have to create "defensive copies." The
+ mutator methods from Map
all throw
+ UnsupportedOperationException
.
+
+
+ The ConfigValue.valueType()
method on an object returns
+ ConfigValueType.OBJECT
.
+
+
+ In most cases you want to use the Config
interface rather than this
+ one. Call toConfig()
to convert a ConfigObject
to a
+ Config
.
+
+
+ The API for a ConfigObject
is in terms of keys, while the API for a
+ Config
is in terms of path expressions. Conceptually,
+ ConfigObject
is a tree of maps from keys to values, while a
+ Config
is a one-level map from paths to values.
+
+
+ Use ConfigUtil.joinPath(java.lang.String...)
and ConfigUtil.splitPath(java.lang.String)
to convert
+ between path expressions and individual path elements (keys).
+
+
+ A ConfigObject
may contain null values, which will have
+ ConfigValue.valueType()
equal to ConfigValueType.NULL
. If
+ get()
returns Java's null then the key was not present in the parsed
+ file (or wherever this value tree came from). If get()
returns a
+ ConfigValue
with type ConfigValueType#NULL
then the key was
+ set to null explicitly in the config file.
+
+
+ Do not implement ConfigObject
; it should only be implemented
+ by the config library. Arbitrary implementations will not work because the
+ library internals assume a specific concrete implementation. Also, this
+ interface is likely to grow new methods over time, so third-party
+ implementations will break.
+
+ +
+
+Nested Class Summary | +
---|
Nested classes/interfaces inherited from interface java.util.Map | +
---|
Map.Entry<K,V> |
+
+Method Summary | +|
---|---|
+ ConfigValue |
+get(Object key)
+
++ Gets a ConfigValue at the given key, or returns null if there is
+ no value. |
+
+ Config |
+toConfig()
+
++ Converts this object to a Config instance, enabling you to use
+ path expressions to find values in the object. |
+
+ Map<String,Object> |
+unwrapped()
+
++ Recursively unwraps the object, returning a map from String to whatever + plain Java values are unwrapped from the object's values. |
+
+ ConfigObject |
+withFallback(ConfigMergeable other)
+
++ Returns a new value computed by merging this value with another, with + keys in this value "winning" over the other one. |
+
+ ConfigObject |
+withOnlyKey(String key)
+
++ Clone the object with only the given key (and its children) retained; all + sibling keys are removed. |
+
+ ConfigObject |
+withoutKey(String key)
+
++ Clone the object with the given key removed. |
+
+ ConfigObject |
+withValue(String key,
+ ConfigValue value)
+
++ Returns a ConfigObject based on this one, but with the given key
+ set to the given value. |
+
Methods inherited from interface com.typesafe.config.ConfigValue | +
---|
atKey, atPath, origin, render, render, valueType |
+
Methods inherited from interface java.util.Map | +
---|
clear, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
+
+Method Detail | +
---|
+Config toConfig()+
Config
instance, enabling you to use
+ path expressions to find values in the object. This is a constant-time
+ operation (it is not proportional to the size of the object).
++
Config
with this object as its root+Map<String,Object> unwrapped()+
+
unwrapped
in interface ConfigValue
Map
containing plain Java objects+ConfigObject withFallback(ConfigMergeable other)+
ConfigMergeable
ConfigObject
and Config
instances do anything in this
+ method (they need to merge the fallback keys into themselves). All other
+ values just return the original value, since they automatically override
+ any fallback.
+
+ + The semantics of merging are described in the spec + for HOCON. + +
+ Note that objects do not merge "across" non-objects; if you write
+ object.withFallback(nonObject).withFallback(otherObject)
,
+ then otherObject
will simply be ignored. This is an
+ intentional part of how merging works. Both non-objects, and any object
+ which has fallen back to a non-object, block subsequent fallbacks.
+
+
withFallback
in interface ConfigMergeable
withFallback
in interface ConfigValue
other
- an object whose keys should be used if the keys are not
+ present in this one
++ConfigValue get(Object key)+
ConfigValue
at the given key, or returns null if there is
+ no value. The returned ConfigValue
may have
+ ConfigValueType.NULL
or any other type, and the passed-in key
+ must be a key in this object, rather than a path expression.
++
get
in interface Map<String,ConfigValue>
key
- key to look up
++ConfigObject withOnlyKey(String key)+
+
key
- key to keep
++ConfigObject withoutKey(String key)+
+
key
- key to remove
++ConfigObject withValue(String key, + ConfigValue value)+
ConfigObject
based on this one, but with the given key
+ set to the given value. Does not modify this instance (since it's
+ immutable). If the key already has a value, that value is replaced. To
+ remove a value, use withoutKey().
++
key
- key to addvalue
- value at the new key
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigOrigin
+Represents the origin (such as filename and line number) of a
+ ConfigValue
for use in error messages. Obtain the origin of a value
+ with ConfigValue.origin()
. Exceptions may have an origin, see
+ ConfigException.origin
, but be careful because
+ ConfigException.origin()
may return null.
+
+
+ It's best to use this interface only for debugging; its accuracy is + "best effort" rather than guaranteed, and a potentially-noticeable amount of + memory could probably be saved if origins were not kept around, so in the + future there might be some option to discard origins. + +
+ Do not implement this interface; it should only be implemented by + the config library. Arbitrary implementations will not work because the + library internals assume a specific concrete implementation. Also, this + interface is likely to grow new methods over time, so third-party + implementations will break. +
+ +
+
+Method Summary | +|
---|---|
+ List<String> |
+comments()
+
++ Returns any comments that appeared to "go with" this place in the file. |
+
+ String |
+description()
+
++ Returns a string describing the origin of a value or exception. |
+
+ String |
+filename()
+
++ Returns a filename describing the origin. |
+
+ int |
+lineNumber()
+
++ Returns a line number where the value or exception originated. |
+
+ String |
+resource()
+
++ Returns a classpath resource name describing the origin. |
+
+ URL |
+url()
+
++ Returns a URL describing the origin. |
+
+Method Detail | +
---|
+String description()+
+
+String filename()+
+
+URL url()+
+
+String resource()+
+
+int lineNumber()+
+
+List<String> comments()+
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++com.typesafe.config.ConfigParseOptions +
public final class ConfigParseOptions
+A set of options related to parsing. + +
+ 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) ++
+ +
+
+Method Summary | +|
---|---|
+ ConfigParseOptions |
+appendIncluder(ConfigIncluder includer)
+
++ |
+
+static ConfigParseOptions |
+defaults()
+
++ |
+
+ boolean |
+getAllowMissing()
+
++ |
+
+ ClassLoader |
+getClassLoader()
+
++ Get the class loader; never returns null , if the class loader was
+ unset, returns
+ Thread.currentThread().getContextClassLoader() . |
+
+ ConfigIncluder |
+getIncluder()
+
++ |
+
+ String |
+getOriginDescription()
+
++ |
+
+ ConfigSyntax |
+getSyntax()
+
++ |
+
+ ConfigParseOptions |
+prependIncluder(ConfigIncluder includer)
+
++ |
+
+ ConfigParseOptions |
+setAllowMissing(boolean allowMissing)
+
++ Set to false to throw an exception if the item being parsed (for example + a file) is missing. |
+
+ ConfigParseOptions |
+setClassLoader(ClassLoader loader)
+
++ Set the class loader. |
+
+ ConfigParseOptions |
+setIncluder(ConfigIncluder includer)
+
++ Set a ConfigIncluder which customizes how includes are handled. |
+
+ ConfigParseOptions |
+setOriginDescription(String originDescription)
+
++ Set a description for the thing being parsed. |
+
+ ConfigParseOptions |
+setSyntax(ConfigSyntax syntax)
+
++ Set the file format. |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Method Detail | +
---|
+public static ConfigParseOptions defaults()+
+public ConfigParseOptions setSyntax(ConfigSyntax syntax)+
ConfigSyntax.CONF
.
++
syntax
- a syntax or null
for best guess
++public ConfigSyntax getSyntax()+
+public ConfigParseOptions setOriginDescription(String originDescription)+
ConfigOrigin
of the parsed values.
++
originDescription
-
++public String getOriginDescription()+
+public ConfigParseOptions setAllowMissing(boolean allowMissing)+
+
allowMissing
-
++public boolean getAllowMissing()+
+public ConfigParseOptions setIncluder(ConfigIncluder includer)+
+
includer
-
++public ConfigParseOptions prependIncluder(ConfigIncluder includer)+
+public ConfigParseOptions appendIncluder(ConfigIncluder includer)+
+public ConfigIncluder getIncluder()+
+public ConfigParseOptions setClassLoader(ClassLoader loader)+
Thread.currentThread().getContextClassLoader()
will be used.
++
loader
- a class loader or null
to use thread context class
+ loader
++public ClassLoader getClassLoader()+
null
, if the class loader was
+ unset, returns
+ Thread.currentThread().getContextClassLoader()
.
++
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigParseable
+An opaque handle to something that can be parsed, obtained from
+ ConfigIncludeContext
.
+
+
+ Do not implement this interface; it should only be implemented by + the config library. Arbitrary implementations will not work because the + library internals assume a specific concrete implementation. Also, this + interface is likely to grow new methods over time, so third-party + implementations will break. +
+ +
+
+Method Summary | +|
---|---|
+ ConfigParseOptions |
+options()
+
++ Get the initial options, which can be modified then passed to parse(). |
+
+ ConfigOrigin |
+origin()
+
++ Returns a ConfigOrigin describing the origin of the parseable
+ item. |
+
+ ConfigObject |
+parse(ConfigParseOptions options)
+
++ Parse whatever it is. |
+
+Method Detail | +
---|
+ConfigObject parse(ConfigParseOptions options)+
options()
but you could tweak them if you
+ like.
++
options
- parse options, should be based on the ones from
+ options()
+ConfigOrigin origin()+
ConfigOrigin
describing the origin of the parseable
+ item.
++
+ConfigParseOptions options()+
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++com.typesafe.config.ConfigRenderOptions +
public final class ConfigRenderOptions
+
+ A set of options related to rendering a ConfigValue
. Passed to
+ ConfigValue.render(ConfigRenderOptions)
.
+
+
+ Here is an example of creating a ConfigRenderOptions
:
+
+
+ ConfigRenderOptions options = + ConfigRenderOptions.defaults().setComments(false) ++
+ +
+
+Method Summary | +|
---|---|
+static ConfigRenderOptions |
+concise()
+
++ Returns concise render options (no whitespace or comments). |
+
+static ConfigRenderOptions |
+defaults()
+
++ Returns the default render options which are verbose (commented and + formatted). |
+
+ boolean |
+getComments()
+
++ Returns whether the options enable comments. |
+
+ boolean |
+getFormatted()
+
++ Returns whether the options enable formatting. |
+
+ boolean |
+getJson()
+
++ Returns whether the options enable JSON. |
+
+ boolean |
+getOriginComments()
+
++ Returns whether the options enable automated origin comments. |
+
+ ConfigRenderOptions |
+setComments(boolean value)
+
++ Returns options with comments toggled. |
+
+ ConfigRenderOptions |
+setFormatted(boolean value)
+
++ Returns options with formatting toggled. |
+
+ ConfigRenderOptions |
+setJson(boolean value)
+
++ Returns options with JSON toggled. |
+
+ ConfigRenderOptions |
+setOriginComments(boolean value)
+
++ Returns options with origin comments toggled. |
+
+ String |
+toString()
+
++ |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
+Method Detail | +
---|
+public static ConfigRenderOptions defaults()+
concise()
for stripped-down
+ options. This rendering will not be valid JSON since it has comments.
++
+public static ConfigRenderOptions concise()+
Config
, the concise rendering will be valid JSON.
++
+public ConfigRenderOptions setComments(boolean value)+
setOriginComments(boolean)
.
++
value
- true to include comments in the render
++public boolean getComments()+
+
+public ConfigRenderOptions setOriginComments(boolean value)+
ConfigValue.origin()
of that setting's value. For example these
+ comments might tell you which file a setting comes from.
+
+
+ setOriginComments()
controls only these autogenerated
+ "origin of this setting" comments, to toggle regular comments use
+ setComments(boolean)
.
+
+
value
- true to include autogenerated setting-origin comments in the
+ render
++public boolean getOriginComments()+
+
+public ConfigRenderOptions setFormatted(boolean value)+
+
value
- true to include comments in the render
++public boolean getFormatted()+
+
+public ConfigRenderOptions setJson(boolean value)+
setComments(boolean)
+ and setOriginComments(boolean)
options. So if you enable
+ comments you will get invalid JSON despite setting this to true.
++
value
- true to include non-JSON extensions in the render
++public boolean getJson()+
+
+public String toString()+ + +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++com.typesafe.config.ConfigResolveOptions +
public final class ConfigResolveOptions
+A set of options related to resolving substitutions. Substitutions use the
+ ${foo.bar}
syntax and are documented in the HOCON
+ spec.
+
+ This object is immutable, so the "setters" return a new object. +
+ Here is an example of creating a custom ConfigResolveOptions
:
+
+
+ ConfigResolveOptions options = ConfigResolveOptions.defaults() + .setUseSystemEnvironment(false) ++
+ In addition to defaults()
, there's a prebuilt
+ noSystem()
which avoids looking at any system
+ environment variables or other external system information. (Right now,
+ environment variables are the only example.)
+
+ +
+
+Method Summary | +|
---|---|
+static ConfigResolveOptions |
+defaults()
+
++ Returns the default resolve options. |
+
+ boolean |
+getUseSystemEnvironment()
+
++ Returns whether the options enable use of system environment variables. |
+
+static ConfigResolveOptions |
+noSystem()
+
++ Returns resolve options that disable any reference to "system" data + (currently, this means environment variables). |
+
+ ConfigResolveOptions |
+setUseSystemEnvironment(boolean value)
+
++ Returns options with use of environment variables set to the given value. |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Method Detail | +
---|
+public static ConfigResolveOptions defaults()+
+
+public static ConfigResolveOptions noSystem()+
+
+public ConfigResolveOptions setUseSystemEnvironment(boolean value)+
+
value
- true to resolve substitutions falling back to environment
+ variables.
++public boolean getUseSystemEnvironment()+
+
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | ++DETAIL: ENUM CONSTANTS | FIELD | METHOD | +
+java.lang.Object ++java.lang.Enum<ConfigSyntax> +
com.typesafe.config.ConfigSyntax +
public enum ConfigSyntax
+The syntax of a character stream, JSON, HOCON + aka ".conf", or Java properties. +
+ +
+
+Enum Constant Summary | +|
---|---|
CONF
+
++ The JSON-superset HOCON format. |
+|
JSON
+
++ Pedantically strict JSON format; no + comments, no unexpected commas, no duplicate keys in the same object. |
+|
PROPERTIES
+
++ Standard Java properties format. |
+
+Method Summary | +|
---|---|
+static ConfigSyntax |
+valueOf(String name)
+
++ Returns the enum constant of this type with the specified name. |
+
+static ConfigSyntax[] |
+values()
+
++ Returns an array containing the constants of this enum type, in +the order they are declared. |
+
Methods inherited from class java.lang.Enum | +
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
+
Methods inherited from class java.lang.Object | +
---|
getClass, notify, notifyAll, wait, wait, wait |
+
+Enum Constant Detail | +
---|
+public static final ConfigSyntax JSON+
+
+public static final ConfigSyntax CONF+
+
+public static final ConfigSyntax PROPERTIES+
+
+Method Detail | +
---|
+public static ConfigSyntax[] values()+
+for (ConfigSyntax c : ConfigSyntax.values()) + System.out.println(c); ++
+
+public static ConfigSyntax valueOf(String name)+
+
name
- the name of the enum constant to be returned.
+IllegalArgumentException
- if this enum type has no constant
+with the specified name
+NullPointerException
- if the argument is null
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | ++DETAIL: ENUM CONSTANTS | FIELD | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++com.typesafe.config.ConfigUtil +
public final class ConfigUtil
+Contains static utility methods. +
+ +
+
+Method Summary | +|
---|---|
+static String |
+joinPath(List<String> elements)
+
++ Converts a list of strings to a path expression, by quoting the path + elements as needed and then joining them separated by a period. |
+
+static String |
+joinPath(String... elements)
+
++ Converts a list of keys to a path expression, by quoting the path + elements as needed and then joining them separated by a period. |
+
+static String |
+quoteString(String s)
+
++ Quotes and escapes a string, as in the JSON specification. |
+
+static List<String> |
+splitPath(String path)
+
++ Converts a path expression into a list of keys, by splitting on period + and unquoting the individual path elements. |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Method Detail | +
---|
+public static String quoteString(String s)+
+
s
- a string
++public static String joinPath(String... elements)+
Config
, while individual path
+ elements are usable with a ConfigObject
.
++
elements
- the keys in the path
+ConfigException
- if there are no elements+public static String joinPath(List<String> elements)+
Config
, while individual path
+ elements are usable with a ConfigObject
.
++
elements
- the keys in the path
+ConfigException
- if the list is empty+public static List<String> splitPath(String path)+
Config
, while individual path elements are usable with a
+ ConfigObject
.
++
path
- a path expression
+ConfigException
- if the path expression is invalid
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
public interface ConfigValue
+An immutable value, following the JSON type + schema. + +
+ Because this object is immutable, it is safe to use from multiple threads and + there's no need for "defensive copies." + +
+ Do not implement ConfigValue
; it should only be implemented
+ by the config library. Arbitrary implementations will not work because the
+ library internals assume a specific concrete implementation. Also, this
+ interface is likely to grow new methods over time, so third-party
+ implementations will break.
+
+ +
+
+Method Summary | +|
---|---|
+ Config |
+atKey(String key)
+
++ Places the value inside a Config at the given key. |
+
+ Config |
+atPath(String path)
+
++ Places the value inside a Config at the given path. |
+
+ ConfigOrigin |
+origin()
+
++ The origin of the value (file, line number, etc.), for debugging and + error messages. |
+
+ String |
+render()
+
++ Renders the config value as a HOCON string. |
+
+ String |
+render(ConfigRenderOptions options)
+
++ Renders the config value to a string, using the provided options. |
+
+ Object |
+unwrapped()
+
++ Returns the value as a plain Java boxed value, that is, a String ,
+ Number , Boolean , Map<String,Object> ,
+ List<Object> , or null , matching the valueType()
+ of this ConfigValue . |
+
+ ConfigValueType |
+valueType()
+
++ The ConfigValueType of the value; matches the JSON type schema. |
+
+ ConfigValue |
+withFallback(ConfigMergeable other)
+
++ Returns a new value computed by merging this value with another, with + keys in this value "winning" over the other one. |
+
+Method Detail | +
---|
+ConfigOrigin origin()+
+
+ConfigValueType valueType()+
ConfigValueType
of the value; matches the JSON type schema.
++
+Object unwrapped()+
String
,
+ Number
, Boolean
, Map<String,Object>
,
+ List<Object>
, or null
, matching the valueType()
+ of this ConfigValue
. If the value is a ConfigObject
or
+ ConfigList
, it is recursively unwrapped.
++
+String render()+
+ If the config value has not been resolved (see Config.resolve()
),
+ it's possible that it can't be rendered as valid HOCON. In that case the
+ rendering should still be useful for debugging but you might not be able
+ to parse it.
+
+
+ This method is equivalent to
+ render(ConfigRenderOptions.defaults())
.
+
+
+String render(ConfigRenderOptions options)+
+ If the config value has not been resolved (see Config.resolve()
),
+ it's possible that it can't be rendered as valid HOCON. In that case the
+ rendering should still be useful for debugging but you might not be able
+ to parse it.
+
+
+ If the config value has been resolved and the options disable all + HOCON-specific features (such as comments), the rendering will be valid + JSON. If you enable HOCON-only features such as comments, the rendering + will not be valid JSON. +
+
options
- the rendering options
++ConfigValue withFallback(ConfigMergeable other)+
ConfigMergeable
ConfigObject
and Config
instances do anything in this
+ method (they need to merge the fallback keys into themselves). All other
+ values just return the original value, since they automatically override
+ any fallback.
+
+ + The semantics of merging are described in the spec + for HOCON. + +
+ Note that objects do not merge "across" non-objects; if you write
+ object.withFallback(nonObject).withFallback(otherObject)
,
+ then otherObject
will simply be ignored. This is an
+ intentional part of how merging works. Both non-objects, and any object
+ which has fallen back to a non-object, block subsequent fallbacks.
+
+
withFallback
in interface ConfigMergeable
other
- an object whose keys should be used if the keys are not
+ present in this one
++Config atPath(String path)+
Config
at the given path. See also
+ atKey().
++
path
- path to store this value at.
+Config
instance containing this value at the given
+ path.+Config atKey(String key)+
Config
at the given key. See also
+ atPath().
++
key
- key to store this value at.
+Config
instance containing this value at the given key.
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object ++com.typesafe.config.ConfigValueFactory +
public final class ConfigValueFactory
+This class holds some static factory methods for building ConfigValue
+ instances. See also ConfigFactory
which has methods for parsing files
+ and certain in-memory data structures.
+
+ +
+
+Method Summary | +|
---|---|
+static ConfigValue |
+fromAnyRef(Object object)
+
++ See the other overload fromAnyRef(Object,String) for details,
+ this one just uses a default origin description. |
+
+static ConfigValue |
+fromAnyRef(Object object,
+ String originDescription)
+
++ Creates a ConfigValue from a plain Java boxed value, which may be a + Boolean, Number, String, Map, Iterable, or null. |
+
+static ConfigList |
+fromIterable(Iterable<? extends Object> values)
+
++ See the other overload of fromIterable(Iterable, String) for
+ details, this one just uses a default origin description. |
+
+static ConfigList |
+fromIterable(Iterable<? extends Object> values,
+ String originDescription)
+
++ See the fromAnyRef() documentation for details. |
+
+static ConfigObject |
+fromMap(Map<String,? extends Object> values)
+
++ See the other overload fromMap(Map,String) for details, this one
+ just uses a default origin description. |
+
+static ConfigObject |
+fromMap(Map<String,? extends Object> values,
+ String originDescription)
+
++ See the fromAnyRef() documentation for details. |
+
Methods inherited from class java.lang.Object | +
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Method Detail | +
---|
+public static ConfigValue fromAnyRef(Object object, + String originDescription)+
+ In a Map passed to fromAnyRef(), the map's keys are plain keys, not path + expressions. So if your Map has a key "foo.bar" then you will get one + object with a key called "foo.bar", rather than an object with a key + "foo" containing another object with a key "bar". + +
+ The originDescription will be used to set the origin() field on the + ConfigValue. It should normally be the name of the file the values came + from, or something short describing the value such as "default settings". + The originDescription is prefixed to error messages so users can tell + where problematic values are coming from. + +
+ Supplying the result of ConfigValue.unwrapped() to this function is + guaranteed to work and should give you back a ConfigValue that matches + the one you unwrapped. The re-wrapped ConfigValue will lose some + information that was present in the original such as its origin, but it + will have matching values. + +
+ This function throws if you supply a value that cannot be converted to a + ConfigValue, but supplying such a value is a bug in your program, so you + should never handle the exception. Just fix your program (or report a bug + against this library). +
+
object
- object to convert to ConfigValueoriginDescription
- name of origin file or brief description of what the value is
++public static ConfigObject fromMap(Map<String,? extends Object> values, + String originDescription)+
Map
and returns
+ ConfigObject
rather than ConfigValue
.
+
+
+ If your Map has a key "foo.bar" then you will get one object with a key
+ called "foo.bar", rather than an object with a key "foo" containing
+ another object with a key "bar". The keys in the map are keys; not path
+ expressions. That is, the Map corresponds exactly to a single
+ ConfigObject
. The keys will not be parsed or modified, and the
+ values are wrapped in ConfigValue. To get nested ConfigObject
,
+ some of the values in the map would have to be more maps.
+
+
+ See also ConfigFactory.parseMap(Map,String)
which interprets the
+ keys in the map as path expressions.
+
+
values
- originDescription
-
+ConfigObject
value+public static ConfigList fromIterable(Iterable<? extends Object> values, + String originDescription)+
Iterable
and returns
+ ConfigList
rather than ConfigValue
.
++
values
- originDescription
-
+ConfigList
value+public static ConfigValue fromAnyRef(Object object)+
fromAnyRef(Object,String)
for details,
+ this one just uses a default origin description.
++
object
-
+ConfigValue
+public static ConfigObject fromMap(Map<String,? extends Object> values)+
fromMap(Map,String)
for details, this one
+ just uses a default origin description.
+
+
+ See also ConfigFactory.parseMap(Map)
which interprets the keys in
+ the map as path expressions.
+
+
values
-
+ConfigObject
+public static ConfigList fromIterable(Iterable<? extends Object> values)+
fromIterable(Iterable, String)
for
+ details, this one just uses a default origin description.
++
values
-
+ConfigList
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | ++DETAIL: ENUM CONSTANTS | FIELD | METHOD | +
+java.lang.Object ++java.lang.Enum<ConfigValueType> +
com.typesafe.config.ConfigValueType +
public enum ConfigValueType
+The type of a configuration value (following the JSON type schema). +
+ +
+
+Enum Constant Summary | +|
---|---|
BOOLEAN
+
++ |
+|
LIST
+
++ |
+|
NULL
+
++ |
+|
NUMBER
+
++ |
+|
OBJECT
+
++ |
+|
STRING
+
++ |
+
+Method Summary | +|
---|---|
+static ConfigValueType |
+valueOf(String name)
+
++ Returns the enum constant of this type with the specified name. |
+
+static ConfigValueType[] |
+values()
+
++ Returns an array containing the constants of this enum type, in +the order they are declared. |
+
Methods inherited from class java.lang.Enum | +
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
+
Methods inherited from class java.lang.Object | +
---|
getClass, notify, notifyAll, wait, wait, wait |
+
+Enum Constant Detail | +
---|
+public static final ConfigValueType OBJECT+
+public static final ConfigValueType LIST+
+public static final ConfigValueType NUMBER+
+public static final ConfigValueType BOOLEAN+
+public static final ConfigValueType NULL+
+public static final ConfigValueType STRING+
+Method Detail | +
---|
+public static ConfigValueType[] values()+
+for (ConfigValueType c : ConfigValueType.values()) + System.out.println(c); ++
+
+public static ConfigValueType valueOf(String name)+
+
name
- the name of the enum constant to be returned.
+IllegalArgumentException
- if this enum type has no constant
+with the specified name
+NullPointerException
- if the argument is null
+
+
|
++ + | +|||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||
+ SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | ++DETAIL: ENUM CONSTANTS | FIELD | METHOD | +
+Interfaces
+
+ +Config + +ConfigIncludeContext + +ConfigIncluder + +ConfigIncluderClasspath + +ConfigIncluderFile + +ConfigIncluderURL + +ConfigList + +ConfigMergeable + +ConfigObject + +ConfigOrigin + +ConfigParseable + +ConfigValue |
+
+Classes
+
+ +ConfigException.ValidationProblem + +ConfigFactory + +ConfigParseOptions + +ConfigRenderOptions + +ConfigResolveOptions + +ConfigUtil + +ConfigValueFactory |
+
+Enums
+
+ +ConfigSyntax + +ConfigValueType |
+
+
+
|
++ + | +|||||||
+ PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +
+See:
+
+ Description
+
+ +
+Interface Summary | +|
---|---|
Config | +An immutable map from config paths to config values. | +
ConfigIncludeContext | +Context provided to a ConfigIncluder ; this interface is only useful
+ inside a ConfigIncluder implementation, and is not intended for apps
+ to implement. |
+
ConfigIncluder | +Implement this interface and provide an instance to
+ ConfigParseOptions.setIncluder() to
+ customize handling of include statements in config files. |
+
ConfigIncluderClasspath | +Implement this in addition to ConfigIncluder if you want to
+ support inclusion of files with the include classpath("resource")
+ syntax. |
+
ConfigIncluderFile | +Implement this in addition to ConfigIncluder if you want to
+ support inclusion of files with the include file("filename") syntax. |
+
ConfigIncluderURL | +Implement this in addition to ConfigIncluder if you want to
+ support inclusion of files with the include url("http://example.com")
+ syntax. |
+
ConfigList | +Subtype of ConfigValue representing a list value, as in JSON's
+ [1,2,3] syntax. |
+
ConfigMergeable | +Marker for types whose instances can be merged, that is Config and
+ ConfigValue . |
+
ConfigObject | +Subtype of ConfigValue representing an object (dictionary, map)
+ value, as in JSON's { "a" : 42 } syntax. |
+
ConfigOrigin | +Represents the origin (such as filename and line number) of a
+ ConfigValue for use in error messages. |
+
ConfigParseable | +An opaque handle to something that can be parsed, obtained from
+ ConfigIncludeContext . |
+
ConfigValue | +An immutable value, following the JSON type + schema. | +
+ +
+Class Summary | +|
---|---|
ConfigException.ValidationProblem | +Information about a problem that occurred in Config.checkValid(com.typesafe.config.Config, java.lang.String...) . |
+
ConfigFactory | +Contains static methods for creating Config instances. |
+
ConfigParseOptions | +A set of options related to parsing. | +
ConfigRenderOptions | +
+ A set of options related to rendering a ConfigValue . |
+
ConfigResolveOptions | +A set of options related to resolving substitutions. | +
ConfigUtil | +Contains static utility methods. | +
ConfigValueFactory | +This class holds some static factory methods for building ConfigValue
+ instances. |
+
+ +
+Enum Summary | +|
---|---|
ConfigSyntax | +The syntax of a character stream, JSON, HOCON + aka ".conf", or Java properties. | +
ConfigValueType | +The type of a configuration value (following the JSON type schema). | +
+ +
+Exception Summary | +|
---|---|
ConfigException | +All exceptions thrown by the library are subclasses of
+ ConfigException . |
+
ConfigException.BadPath | +Exception indicating that a path expression was invalid. | +
ConfigException.BadValue | +Exception indicating that a value was messed up, for example you may have + asked for a duration and the value can't be sensibly parsed as a + duration. | +
ConfigException.BugOrBroken | +Exception indicating that there's a bug in something (possibly the + library itself) or the runtime environment is broken. | +
ConfigException.Generic | +Exception that doesn't fall into any other category. | +
ConfigException.IO | +Exception indicating that there was an IO error. | +
ConfigException.Missing | +Exception indicates that the setting was never set to anything, not even + null. | +
ConfigException.NotResolved | +Exception indicating that you tried to use a function that requires
+ substitutions to be resolved, but substitutions have not been resolved
+ (that is, Config.resolve() was not called). |
+
ConfigException.Null | +Exception indicates that the setting was treated as missing because it + was set to null. | +
ConfigException.Parse | +Exception indicating that there was a parse error. | +
ConfigException.UnresolvedSubstitution | +Exception indicating that a substitution did not resolve to anything. | +
ConfigException.ValidationFailed | +Exception indicating that Config.checkValid(com.typesafe.config.Config, java.lang.String...) found validity
+ problems. |
+
ConfigException.WrongType | +Exception indicating that the type of a value does not match the type you + requested. | +
+
+An API for loading and using configuration files, see the project site +for more information. +
+ +
+Typically you would load configuration with a static method from ConfigFactory
and then use
+it with methods in the Config
interface.
+
+An application can simply call ConfigFactory.load()
and place
+its configuration in "application.conf" on the classpath.
+If you use the default configuration from ConfigFactory.load()
+there's no need to pass a configuration to your libraries
+and frameworks, as long as they all default to this same default, which they should.
+
+A library or framework should ship a file "reference.conf" in its jar, and allow an application to pass in a
+Config
to be used for the library. If no Config
is provided,
+call ConfigFactory.load()
+to get the default one. Typically a library might offer two constructors, one with a Config
parameter
+and one which uses ConfigFactory.load()
.
+
+You can find an example app and library on GitHub. +
++ +
+
+
+
|
++ + | +|||||||
+ PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+ +++Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
+
+- Interfaces (italic)
- Classes
- Enums
- Exceptions
- Errors
- Annotation Types
+ ++ ++Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.- Class inheritance diagram
- Direct Subclasses
- All Known Subinterfaces
- All Known Implementing Classes
- Class/interface declaration
- Class/interface description +
+
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary +
+
- Field Detail
- Constructor Detail
- Method Detail
+ ++ ++Each annotation type has its own separate page with the following sections:
+
+- Annotation Type declaration
- Annotation Type description
- Required Element Summary
- Optional Element Summary
- Element Detail
+ +++Each enum has its own separate page with the following sections:
+
+- Enum declaration
- Enum description
- Enum Constant Summary
- Enum Constant Detail
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with+java.lang.Object
. The interfaces do not inherit fromjava.lang.Object
.+
+- When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
- When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.+
+
+
+
+
+This help file applies to API documentation generated using the standard doclet.
+
+
+
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
Config
at the given key.
+Config
at the given key.
+Config
at the given path.
+Config
at the given path.
+ConfigException
.Config.resolve()
was not called).Config.checkValid(com.typesafe.config.Config, java.lang.String...)
found validity
+ problems.Config.checkValid(com.typesafe.config.Config, java.lang.String...)
.Config
instances.ConfigIncluder
; this interface is only useful
+ inside a ConfigIncluder
implementation, and is not intended for apps
+ to implement.ConfigParseOptions.setIncluder()
to
+ customize handling of include
statements in config files.ConfigIncluder
if you want to
+ support inclusion of files with the include classpath("resource")
+ syntax.ConfigIncluder
if you want to
+ support inclusion of files with the include file("filename")
syntax.ConfigIncluder
if you want to
+ support inclusion of files with the include url("http://example.com")
+ syntax.ConfigValue
representing a list value, as in JSON's
+ [1,2,3]
syntax.Config
and
+ ConfigValue
.ConfigValue
representing an object (dictionary, map)
+ value, as in JSON's { "a" : 42 }
syntax.ConfigValue
for use in error messages.ConfigIncludeContext
.ConfigValue
.ConfigValue
+ instances.ConfigFactory.defaultOverrides()
but allows you to specify a class loader
+ to use rather than the current context class loader.
+ConfigFactory.defaultReference()
but allows you to specify a class loader
+ to use rather than the current context class loader.
+ConfigOrigin
for this Config
.
+the root object
.
+ConfigValueFactory.fromAnyRef(Object,String)
for details,
+ this one just uses a default origin description.
+ConfigValueFactory.fromIterable(Iterable, String)
for
+ details, this one just uses a default origin description.
+ConfigValueFactory.fromMap(Map,String)
for details, this one
+ just uses a default origin description.
+ConfigValue
at the given key, or returns null if there is
+ no value.
+Boolean
, Integer
, and
+ so on - see ConfigValue.unwrapped()
).
+null
, if the class loader was
+ unset, returns
+ Thread.currentThread().getContextClassLoader()
.
+ConfigList
, which
+ implements java.util.List<ConfigValue>
.
+Config
's root object contains no key-value
+ pairs.
+ConfigFactory.load(String)
but uses the supplied class loader instead of
+ the current thread's context class loader.
+ConfigFactory.load(String)
but allows you to specify parse and resolve
+ options.
+ConfigFactory.load(String,ConfigParseOptions,ConfigResolveOptions)
but
+ has a class loader parameter that overrides any from the
+ ConfigParseOptions
.
+Config
+ object rather than loading "application.conf".
+ConfigFactory.load(Config)
but allows you to specify
+ ConfigResolveOptions
.
+ConfigFactory.load(Config,ConfigResolveOptions)
but allows you to specify
+ a class loader other than the context class loader.
+load("application")
in most cases.
+ConfigFactory.load()
but allows specifying parse options
+ConfigFactory.load()
but allows specifying a class loader other than the
+ thread's current context class loader.
+ConfigFactory.load()
but allows specifying a class loader other than the
+ thread's current context class loader, and parse options
+ConfigFactory.load()
but allows specifying a class loader other than the
+ thread's current context class loader, and resolve options
+ConfigFactory.load()
but allows specifying a class loader other than the
+ thread's current context class loader, parse options, and resolve options
+Config
, which may be a file, or a file
+ with a line number, or just a descriptive phrase.
+ConfigOrigin
describing the origin of the parseable
+ item.
+Config
based on a Map
from paths to
+ plain Java values.
+ConfigFactory.parseMap(Map, String)
for details,
+ this one just uses a default origin description.
+ConfigParseable
then use ConfigParseable.options()
+ instead though).
+Properties
object to a
+ ConfigObject
using the rules documented in the HOCON
+ spec.
+Config
.
+Config
.
+ConfigFactory.parseResources(ClassLoader,String,ConfigParseOptions)
but
+ uses thread's current context class loader.
+ConfigFactory.parseResources(ClassLoader,String)
but uses thread's
+ current context class loader.
+ConfigFactory.parseResourcesAnySyntax(ClassLoader,String,ConfigParseOptions)
+ but uses thread's current context class loader.
+ConfigFactory.parseResourcesAnySyntax(ClassLoader,String)
but uses
+ thread's current context class loader.
+${foo.bar}
syntax, see the
+ spec) resolved.
+Config.resolve()
but allows you to specify non-default
+ options.
+Config
as a tree of ConfigObject
.
+Config
containing the system's environment variables.
+Config
containing the system properties from
+ System.getProperties()
, parsed and converted as with
+ ConfigFactory.parseProperties(java.util.Properties, com.typesafe.config.ConfigParseOptions)
.
+Config
instance, enabling you to use
+ path expressions to find values in the object.
+String
,
+ Number
, Boolean
, Map<String,Object>
,
+ List<Object>
, or null
, matching the ConfigValue.valueType()
+ of this ConfigValue
.
+ConfigValueType
of the value; matches the JSON type schema.
+Config
based on this one, but with the given path set
+ to the given value.
+ConfigObject
based on this one, but with the given key
+ set to the given value.
+
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +
+Package com.typesafe.config | +
---|
+Class com.typesafe.config.ConfigException extends RuntimeException implements Serializable | +
---|
+serialVersionUID: 1L + +
+Serialization Methods | +
---|
+private void readObject(ObjectInputStream in) + throws IOException, + ClassNotFoundException+
IOException
+ClassNotFoundException
+private void writeObject(ObjectOutputStream out) + throws IOException+
IOException
+Class com.typesafe.config.ConfigException.BadPath extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.BadValue extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.BugOrBroken extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.Generic extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.IO extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.Missing extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.NotResolved extends ConfigException.BugOrBroken implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.Null extends ConfigException.Missing implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.Parse extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.UnresolvedSubstitution extends ConfigException.Parse implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+Class com.typesafe.config.ConfigException.ValidationFailed extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+Serialized Fields | +
---|
+Iterable<T> problems+
+Class com.typesafe.config.ConfigException.WrongType extends ConfigException implements Serializable | +
---|
+serialVersionUID: 1L + +
+ +
+
+
+
|
++ + | +|||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +