Top Fields Constructors Methods
com.typesafe.config.impl

pack-priv final Class ConfigDelayedMergeObject

extends AbstractConfigObject
implements Unmergeable, ReplaceableMergeStack
Class Inheritance
All Implemented Interfaces
com.typesafe.config.impl.ReplaceableMergeStack, com.typesafe.config.impl.Container, com.typesafe.config.ConfigValue, com.typesafe.config.ConfigMergeable, com.typesafe.config.impl.Unmergeable
Imports
java.util.ArrayList, .Collection, .List, .Map, .Set, com.typesafe.config.ConfigException, .ConfigList, .ConfigMergeable, .ConfigOrigin, .ConfigRenderOptions, .ConfigValue

Field Summary

Modifier and TypeField and Description
private final List<AbstractConfigValue>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected AbstractConfigValue
attemptPeekWithPartialResolve(String
key to look up
key
)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.attemptPeekWithPartialResolve.

Look up the key on an only-partially-resolved object, with no transformation or type conversion of any kind; if 'this' is not resolved then try to look up the key anyway if possible.

protected boolean
public boolean
containsKey(Object
key whose presence in this map is to be tested
key
)

Implements java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key.

public boolean
containsValue(Object
value whose presence in this map is to be tested
value
)

Implements java.util.Map.containsValue.

Returns true if this map maps one or more keys to the specified value.

public Set<Map.Entry<String, ConfigValue>>
entrySet()

Implements java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.

public boolean
equals(Object
object to be compared for equality with this map
other
)

Overrides com.typesafe.config.impl.AbstractConfigValue.equals.

Implements java.util.Map.equals.

Compares the specified object with this map for equality.

public AbstractConfigValue
get(Object
key to look up
key
)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.get.

Implements com.typesafe.config.ConfigObject.get.

Gets a ConfigValue at the given key, or returns null if there is no value.

public boolean
hasDescendant(AbstractConfigValue descendant)

Implements com.typesafe.config.impl.Container.hasDescendant.

Super-expensive full traversal to see if descendant is anywhere underneath this container.

public int
hashCode()

Overrides com.typesafe.config.impl.AbstractConfigValue.hashCode.

Implements java.util.Map.hashCode.

Returns the hash code value for this map.

protected boolean
public boolean
isEmpty()

Implements java.util.Map.isEmpty.

Returns true if this map contains no key-value mappings.

public Set<String>
keySet()

Implements java.util.Map.keySet.

Returns a Set view of the keys contained in this map.

public AbstractConfigValue
makeReplacement(ResolveContext context, int skipping)

Implements com.typesafe.config.impl.ReplaceableMergeStack.makeReplacement.

Make a replacement for this object skipping the given number of elements which are lower in merge priority.

protected final ConfigDelayedMergeObject
protected final ConfigDelayedMergeObject
protected final ConfigDelayedMergeObject
protected ConfigDelayedMergeObject
private static ConfigException
pack-priv ConfigDelayedMergeObject
relativized(Path prefix)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.relativized.

This is used when including one file in another; the included file is relativized to the path it's included into in the parent file.

protected void
protected void
render(StringBuilder sb, int indent, boolean atRoot, ConfigRenderOptions options)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.render.

public AbstractConfigValue
replaceChild(AbstractConfigValue child, AbstractConfigValue replacement)

Implements com.typesafe.config.impl.Container.replaceChild.

Replace a child of this value.

pack-priv ResolveStatus
pack-priv ResolveResult<? extends AbstractConfigObject>
resolveSubstitutions(ResolveContext
state of the current resolve
context
,
ResolveSource
where to look up values
source
)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.resolveSubstitutions.

Called only by ResolveContext.resolve().

public int
size()

Implements java.util.Map.size.

Returns the number of key-value mappings in this map.

public Collection<AbstractConfigValue>
public Map<String, Object>
unwrapped()

Implements com.typesafe.config.ConfigValue.unwrapped, com.typesafe.config.ConfigObject.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.

public Collection<ConfigValue>
values()

Implements java.util.Map.values.

Returns a Collection view of the values contained in this map.

public ConfigDelayedMergeObject
withFallback(ConfigMergeable
an object whose keys should be used as fallbacks, if the keys are not present in this one
mergeable
)

Overrides com.typesafe.config.impl.AbstractConfigObject.withFallback.

Implements com.typesafe.config.ConfigValue.withFallback, com.typesafe.config.ConfigObject.withFallback, com.typesafe.config.ConfigMergeable.withFallback.

Returns a new value computed by merging this value with another, with keys in this value "winning" over the other one.

public ConfigDelayedMergeObject
withOnlyKey(String
key to keep
key
)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withOnlyKey.

Implements com.typesafe.config.ConfigObject.withOnlyKey.

Clone the object with only the given key (and its children) retained; all sibling keys are removed.

pack-priv AbstractConfigObject
protected AbstractConfigObject
public ConfigDelayedMergeObject
withoutKey(String
key to remove
key
)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withoutKey.

Implements com.typesafe.config.ConfigObject.withoutKey.

Clone the object with the given key removed.

pack-priv AbstractConfigObject
public ConfigDelayedMergeObject
withValue(String
key to add
key
,
ConfigValue
value at the new key
value
)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withValue.

Implements com.typesafe.config.ConfigObject.withValue.

Returns a ConfigObject based on this one, but with the given key set to the given value.

pack-priv ConfigDelayedMergeObject
Inherited from com.typesafe.config.impl.AbstractConfigObject:
clearconstructDelayedMergemergeOriginsmergeOriginsnewCopypeekAssumingResolvedpeekPathputputAllremovetoConfigtoFallbackValuevalueTypewithOrigin

Field Detail

stackback to summary
private final List<AbstractConfigValue> stack

Constructor Detail

ConfigDelayedMergeObjectback to summary
pack-priv ConfigDelayedMergeObject(ConfigOrigin origin, List<AbstractConfigValue> stack)

Method Detail

attemptPeekWithPartialResolveback to summary
protected AbstractConfigValue attemptPeekWithPartialResolve(String key)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.attemptPeekWithPartialResolve.

Doc from com.typesafe.config.impl.AbstractConfigObject.attemptPeekWithPartialResolve.

Look up the key on an only-partially-resolved object, with no transformation or type conversion of any kind; if 'this' is not resolved then try to look up the key anyway if possible.

Parameters
key:String

key to look up

Returns:AbstractConfigValue

the value of the key, or null if known not to exist

Annotations
@Override
canEqualback to summary
protected boolean canEqual(Object other)

Overrides com.typesafe.config.impl.AbstractConfigValue.canEqual.

Annotations
@Override
containsKeyback to summary
public boolean containsKey(Object key)

Implements java.util.Map.containsKey.

Doc from java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Objects.equals(key, k). (There can be at most one such mapping.)

Parameters
key:Object

key whose presence in this map is to be tested

Returns:boolean

true if this map contains a mapping for the specified key

Annotations
@Override
containsValueback to summary
public boolean containsValue(Object value)

Implements java.util.Map.containsValue.

Doc from java.util.Map.containsValue.

Returns true if this map maps one or more keys to the specified value. More formally, returns true if and only if this map contains at least one mapping to a value v such that Objects.equals(value, v). This operation will probably require time linear in the map size for most implementations of the Map interface.

Parameters
value:Object

value whose presence in this map is to be tested

Returns:boolean

true if this map maps one or more keys to the specified value

Annotations
@Override
entrySetback to summary
public Set<Map.Entry<String, ConfigValue>> entrySet()

Implements java.util.Map.entrySet.

Doc from java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.

Returns:Set<Map.Entry<String, ConfigValue>>

a set view of the mappings contained in this map

Annotations
@Override
equalsback to summary
public boolean equals(Object other)

Overrides com.typesafe.config.impl.AbstractConfigValue.equals.

Implements java.util.Map.equals.

Doc from java.util.Map.equals.

Compares the specified object with this map for equality. Returns true if the given object is also a map and the two maps represent the same mappings. More formally, two maps m1 and m2 represent the same mappings if m1.entrySet().equals(m2.entrySet()). This ensures that the equals method works properly across different implementations of the Map interface.

Parameters
other:Object

object to be compared for equality with this map

Returns:boolean

true if the specified object is equal to this map

Annotations
@Override
getback to summary
public AbstractConfigValue get(Object key)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.get.

Implements com.typesafe.config.ConfigObject.get.

Doc from com.typesafe.config.ConfigObject.get.

Gets a 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).

Parameters
key:Object

key to look up

Returns:AbstractConfigValue

the value at the key or null if none

Annotations
@Override
hasDescendantback to summary
public boolean hasDescendant(AbstractConfigValue descendant)

Implements com.typesafe.config.impl.Container.hasDescendant.

Doc from com.typesafe.config.impl.Container.hasDescendant.

Super-expensive full traversal to see if descendant is anywhere underneath this container.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides com.typesafe.config.impl.AbstractConfigValue.hashCode.

Implements java.util.Map.hashCode.

Doc from java.util.Map.hashCode.

Returns the hash code value for this map. The hash code of a map is defined to be the sum of the hash codes of each entry in the map's entrySet() view. This ensures that m1.equals(m2) implies that m1.hashCode()==m2.hashCode() for any two maps m1 and m2, as required by the general contract of Object#hashCode.

Returns:int

the hash code value for this map

Annotations
@Override
ignoresFallbacksback to summary
protected boolean ignoresFallbacks()

Overrides com.typesafe.config.impl.AbstractConfigValue.ignoresFallbacks.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements java.util.Map.isEmpty.

Doc from java.util.Map.isEmpty.

Returns true if this map contains no key-value mappings.

Returns:boolean

true if this map contains no key-value mappings

Annotations
@Override
keySetback to summary
public Set<String> keySet()

Implements java.util.Map.keySet.

Doc from java.util.Map.keySet.

Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.

Returns:Set<String>

a set view of the keys contained in this map

Annotations
@Override
makeReplacementback to summary
public AbstractConfigValue makeReplacement(ResolveContext context, int skipping)

Implements com.typesafe.config.impl.ReplaceableMergeStack.makeReplacement.

Doc from com.typesafe.config.impl.ReplaceableMergeStack.makeReplacement.

Make a replacement for this object skipping the given number of elements which are lower in merge priority.

Annotations
@Override
mergedWithNonObjectback to summary
protected final ConfigDelayedMergeObject mergedWithNonObject(AbstractConfigValue fallback)

Overrides com.typesafe.config.impl.AbstractConfigValue.mergedWithNonObject.

Annotations
@Override
mergedWithObjectback to summary
protected final ConfigDelayedMergeObject mergedWithObject(AbstractConfigObject fallback)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.mergedWithObject.

Annotations
@Override
mergedWithTheUnmergeableback to summary
protected final ConfigDelayedMergeObject mergedWithTheUnmergeable(Unmergeable fallback)

Overrides com.typesafe.config.impl.AbstractConfigValue.mergedWithTheUnmergeable.

Annotations
@Override
newCopyback to summary
protected ConfigDelayedMergeObject newCopy(ResolveStatus status, ConfigOrigin origin)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.newCopy.

Annotations
@Override
notResolvedback to summary
private static ConfigException notResolved()
relativizedback to summary
pack-priv ConfigDelayedMergeObject relativized(Path prefix)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.relativized.

Doc from com.typesafe.config.impl.AbstractConfigValue.relativized.

This is used when including one file in another; the included file is relativized to the path it's included into in the parent file. The point is that if you include a file at foo.bar in the parent, and the included file as a substitution ${a.b.c}, the included substitution now needs to be ${foo.bar.a.b.c} because we resolve substitutions globally only after parsing everything.

Returns:ConfigDelayedMergeObject

value relativized to the given path or the same value if nothing to do

Annotations
@Override
renderback to summary
protected void render(StringBuilder sb, int indent, boolean atRoot, String atKey, ConfigRenderOptions options)

Overrides com.typesafe.config.impl.AbstractConfigValue.render.

Annotations
@Override
renderback to summary
protected void render(StringBuilder sb, int indent, boolean atRoot, ConfigRenderOptions options)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.render.

Annotations
@Override
replaceChildback to summary
public AbstractConfigValue replaceChild(AbstractConfigValue child, AbstractConfigValue replacement)

Implements com.typesafe.config.impl.Container.replaceChild.

Doc from com.typesafe.config.impl.Container.replaceChild.

Replace a child of this value. CAUTION if replacement is null, delete the child, which may also delete the parent, or make the parent into a non-container.

Annotations
@Override
resolveStatusback to summary
pack-priv ResolveStatus resolveStatus()

Overrides com.typesafe.config.impl.AbstractConfigValue.resolveStatus.

Annotations
@Override
resolveSubstitutionsback to summary
pack-priv ResolveResult<? extends AbstractConfigObject> resolveSubstitutions(ResolveContext context, ResolveSource source) throws NotPossibleToResolve

Implements abstract com.typesafe.config.impl.AbstractConfigObject.resolveSubstitutions.

Doc from com.typesafe.config.impl.AbstractConfigValue.resolveSubstitutions.

Called only by ResolveContext.resolve().

Parameters
context:ResolveContext

state of the current resolve

source:ResolveSource

where to look up values

Returns:ResolveResult<? extends AbstractConfigObject>

a new value if there were changes, or this if no changes

Annotations
@Override
sizeback to summary
public int size()

Implements java.util.Map.size.

Doc from java.util.Map.size.

Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of key-value mappings in this map

Annotations
@Override
unmergedValuesback to summary
public Collection<AbstractConfigValue> unmergedValues()

Implements com.typesafe.config.impl.Unmergeable.unmergedValues.

Annotations
@Override
unwrappedback to summary
public Map<String, Object> unwrapped()

Implements com.typesafe.config.ConfigValue.unwrapped, com.typesafe.config.ConfigObject.unwrapped.

Doc from com.typesafe.config.ConfigValue.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. If the value is a ConfigObject or ConfigList, it is recursively unwrapped.

Returns:Map<String, Object>

a plain Java value corresponding to this ConfigValue

Annotations
@Override
valuesback to summary
public Collection<ConfigValue> values()

Implements java.util.Map.values.

Doc from java.util.Map.values.

Returns a Collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.

Returns:Collection<ConfigValue>

a collection view of the values contained in this map

Annotations
@Override
withFallbackback to summary
public ConfigDelayedMergeObject withFallback(ConfigMergeable mergeable)

Overrides com.typesafe.config.impl.AbstractConfigObject.withFallback.

Implements com.typesafe.config.ConfigValue.withFallback, com.typesafe.config.ConfigObject.withFallback, com.typesafe.config.ConfigMergeable.withFallback.

Doc from com.typesafe.config.ConfigMergeable.withFallback.

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 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. 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 an intentional 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
Here, the number 10 "wins" and the value of foo would be simply 10. Again, for details see the spec.
Parameters
mergeable:ConfigMergeable

an object whose keys should be used as fallbacks, if the keys are not present in this one

Returns:ConfigDelayedMergeObject

a new object (or the original one, if the fallback doesn't get used)

Annotations
@Override
withOnlyKeyback to summary
public ConfigDelayedMergeObject withOnlyKey(String key)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withOnlyKey.

Implements com.typesafe.config.ConfigObject.withOnlyKey.

Doc from com.typesafe.config.ConfigObject.withOnlyKey.

Clone the object with only the given key (and its children) retained; all sibling keys are removed.

Parameters
key:String

key to keep

Returns:ConfigDelayedMergeObject

a copy of the object minus all keys except the one specified

Annotations
@Override
withOnlyPathback to summary
pack-priv AbstractConfigObject withOnlyPath(Path path)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withOnlyPath.

Annotations
@Override
withOnlyPathOrNullback to summary
protected AbstractConfigObject withOnlyPathOrNull(Path path)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withOnlyPathOrNull.

Annotations
@Override
withoutKeyback to summary
public ConfigDelayedMergeObject withoutKey(String key)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withoutKey.

Implements com.typesafe.config.ConfigObject.withoutKey.

Doc from com.typesafe.config.ConfigObject.withoutKey.

Clone the object with the given key removed.

Parameters
key:String

key to remove

Returns:ConfigDelayedMergeObject

a copy of the object minus the specified key

Annotations
@Override
withoutPathback to summary
pack-priv AbstractConfigObject withoutPath(Path path)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withoutPath.

Annotations
@Override
withValueback to summary
public ConfigDelayedMergeObject withValue(String key, ConfigValue value)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withValue.

Implements com.typesafe.config.ConfigObject.withValue.

Doc from com.typesafe.config.ConfigObject.withValue.

Returns a 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 ConfigObject#withoutKey(String).

Parameters
key:String

key to add

value:ConfigValue

value at the new key

Returns:ConfigDelayedMergeObject

the new instance with the new map entry

Annotations
@Override
withValueback to summary
pack-priv ConfigDelayedMergeObject withValue(Path path, ConfigValue value)

Implements abstract com.typesafe.config.impl.AbstractConfigObject.withValue.

Annotations
@Override