MergeableValue
class AbstractConfigObject
class AbstractConfigValue
class ConfigBoolean
class ConfigConcatenation
class ConfigDelayedMerge
class ConfigDelayedMergeObject
class ConfigDouble
class ConfigInt
class ConfigLong
class ConfigNull
class ConfigNumber
class ConfigReference
class ConfigString
class SerializedConfigValue
class SimpleConfig
class SimpleConfigList
class SimpleConfigObject
Value members
Methods
Inherited methods
Returns a new value computed by merging this value with another, with
keys in this value "winning" over the other one.
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).
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:
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 }
}}}
foo = { a: 42 }
foo = { b: 43 }
}}}
Here, the two objects are merged as if you had written:
{{{
foo = { a: 42, b: 43 }
}}}
foo = { a: 42, b: 43 }
}}}
Only
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. This means that objects do not merge "across"
non-objects; if you write
then
intentional part of how merging works, because non-objects such as
strings and integers replace (rather than merging with) any prior value:
[[ConfigObject]]
and [[Config]]
instances do anything inthis method (they need to merge the fallback keys into themselves). All
other values just return the original value, since they automatically
override any fallback. This means that objects do not merge "across"
non-objects; if you write
object.withFallback(nonObject).withFallback(otherObject)
,then
otherObject
will simply be ignored. This is anintentional part of how merging works, because non-objects such as
strings and integers replace (rather than merging with) any prior value:
{{{
foo = { a: 42 }
foo = 10
}}}
foo = { a: 42 }
foo = 10
}}}
Here, the number 10 "wins" and the value of
simply 10. Again, for details see the spec.
foo
would besimply 10. Again, for details see the spec.
- Value Params
- other
-
an object whose keys should be used as fallbacks, if the keys
are not present in this one
- Returns
-
a new object (or the original one, if the fallback doesn't get
used) - Inhertied from
- ConfigMergeable