${foo.bar} syntax and are documented in the HOCON
spec.
Typically this class would be used with the method
Config#resolve(ConfigResolveOptions).
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 ConfigResolveOptions#defaults, there's a prebuilt
ConfigResolveOptions#noSystem which avoids looking at any system
environment variables or other external system information. (Right now,
environment variables are the only example.)
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private static final ConfigResolver | NULL_RESOLVER
Singleton resolver that never resolves paths. |
| private final ConfigResolver | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| private | ConfigResolveOptions(boolean useSystemEnvironment, boolean allowUnresolved, ConfigResolver resolver)
|
| Modifier and Type | Method and Description |
|---|---|
| public ConfigResolveOptions | Returns: options that use the given resolver as a fallbackthe resolver to fall back to value)Returns options where the given resolver used as a fallback if a reference cannot be otherwise resolved. |
| public static ConfigResolveOptions | |
| public boolean | Returns: true if unresolved substitutions are allowedReturns whether the options allow unresolved substitutions. |
| public ConfigResolver | Returns: the non-null fallback resolverReturns the resolver to use as a fallback if a substitution cannot be otherwise resolved. |
| public boolean | Returns: true if environment variables should be usedReturns whether the options enable use of system environment variables. |
| public static ConfigResolveOptions | Returns: the resolve options with env variables disabledReturns resolve options that disable any reference to "system" data (currently, this means environment variables). |
| public ConfigResolveOptions | Returns: options with requested setting for whether to allow substitutionstrue to silently ignore unresolved substitutions. value)Returns options with "allow unresolved" set to the given value. |
| public ConfigResolveOptions | Returns: options with requested setting for use of environment variablestrue to resolve substitutions falling back to environment
variables. value)Returns options with use of environment variables set to the given value. |
| allowUnresolved | back to summary |
|---|---|
| private final boolean allowUnresolved | |
| NULL_RESOLVER | back to summary |
|---|---|
| private static final ConfigResolver NULL_RESOLVER Singleton resolver that never resolves paths. | |
| resolver | back to summary |
|---|---|
| private final ConfigResolver resolver | |
| useSystemEnvironment | back to summary |
|---|---|
| private final boolean useSystemEnvironment | |
| ConfigResolveOptions | back to summary |
|---|---|
| private ConfigResolveOptions(boolean useSystemEnvironment, boolean allowUnresolved, ConfigResolver resolver) | |
| appendResolver | back to summary |
|---|---|
| public ConfigResolveOptions appendResolver(ConfigResolver value) Returns options where the given resolver used as a fallback if a reference cannot be otherwise resolved. This resolver will only be called after resolution has failed to substitute with a value from within the config itself and with any other resolvers that have been appended before this one. Multiple resolvers can be added using,
ConfigResolveOptions options = ConfigResolveOptions.defaults()
.appendResolver(primary)
.appendResolver(secondary)
.appendResolver(tertiary);
With this config unresolved references will first be resolved with the
primary resolver, if that fails then the secondary, and finally if that
also fails the tertiary.
If all fallbacks fail to return a substitution "allow unresolved"
determines whether resolution fails or continues.
`
| |
| defaults | back to summary |
|---|---|
| public static ConfigResolveOptions defaults() Returns the default resolve options. By default the system environment will be used and unresolved substitutions are not allowed.
| |
| getAllowUnresolved | back to summary |
|---|---|
| public boolean getAllowUnresolved() Returns whether the options allow unresolved substitutions. This method is mostly used by the config lib internally, not by applications.
| |
| getResolver | back to summary |
|---|---|
| public ConfigResolver getResolver() Returns the resolver to use as a fallback if a substitution cannot be otherwise resolved. Never returns null. This method is mostly used by the config lib internally, not by applications.
| |
| getUseSystemEnvironment | back to summary |
|---|---|
| public boolean getUseSystemEnvironment() Returns whether the options enable use of system environment variables. This method is mostly used by the config lib internally, not by applications.
| |
| noSystem | back to summary |
|---|---|
| public static ConfigResolveOptions noSystem() Returns resolve options that disable any reference to "system" data (currently, this means environment variables).
| |
| setAllowUnresolved | back to summary |
|---|---|
| public ConfigResolveOptions setAllowUnresolved(boolean value) Returns options with "allow unresolved" set to the given value. By
default, unresolved substitutions are an error. If unresolved
substitutions are allowed, then a future attempt to use the unresolved
value may fail, but
| |
| setUseSystemEnvironment | back to summary |
|---|---|
| public ConfigResolveOptions setUseSystemEnvironment(boolean value) Returns options with use of environment variables set to the given value.
| |