Because this object is immutable, it is safe to use from multiple threads and there's no need for "defensive copies."
Do not implement interface 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.
| Modifier and Type | Method and Description |
|---|---|
| public Config | |
| public Config | |
| public ConfigOrigin | Returns: where the value came fromThe origin of the value (file, line number, etc.), for debugging and error messages. |
| public String | |
| public String | Returns: the rendered valuethe rendering options options)Renders the config value to a string, using the provided options. |
| public Object | Returns: a plain Java value corresponding to this ConfigValueReturns the value as a plain Java boxed value, that is, a |
| public ConfigValueType | |
| public ConfigValue | withFallback(ConfigMergeable
an object whose keys should be used as fallbacks, if the keys
are not present in this one other)Redeclares com. Returns a new value computed by merging this value with another, with keys in this value "winning" over the other one. |
| public ConfigValue | Returns: the new ConfigValue with the given originthe origin set on the returned value origin)Returns a |
| atKey | back to summary |
|---|---|
| public Config atKey(String key) Places the value inside a | |
| atPath | back to summary |
|---|---|
| public Config atPath(String path) Places the value inside a | |
| origin | back to summary |
|---|---|
| public ConfigOrigin origin() The origin of the value (file, line number, etc.), for debugging and error messages.
| |
| render | back to summary |
|---|---|
| public String render() Renders the config value as a HOCON string. This method is primarily intended for debugging, so it tries to add helpful comments and whitespace.
If the config value has not been resolved (see
This method is equivalent to
| |
| render | back to summary |
|---|---|
| public String render(ConfigRenderOptions options) Renders the config value to a string, using the provided options.
If the config value has not been resolved (see 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.
| |
| unwrapped | back to summary |
|---|---|
| public Object unwrapped() Returns the value as a plain Java boxed value, that is, a
| |
| valueType | back to summary |
|---|---|
| public ConfigValueType valueType() The
| |
| withFallback | back to summary |
|---|---|
| public ConfigValue withFallback(ConfigMergeable other) Redeclares com. Doc from com. Returns a new value computed by merging this value with another, with keys in this value "winning" over the other one. This associative operation may be used to combine configurations from multiple sources (such as multiple configuration files). The semantics of merging are described in the spec for HOCON. Merging typically occurs when either the same object is created twice in the same file, or two config files are both loaded. For example:
foo = { a: 42 }
foo = { b: 43 }
Here, the two objects are merged as if you had written:
foo = { a: 42, b: 43 }
Only
foo = { a: 42 }
foo = 10
Here, the number 10 "wins" and the value of foo would be
simply 10. Again, for details see the spec.
| |
| withOrigin | back to summary |
|---|---|
| public ConfigValue withOrigin(ConfigOrigin origin) Returns a
| |