Top Fields Constructors Methods
com.typesafe.config.impl

pack-priv abstract Class AbstractConfigObject

extends AbstractConfigValue
implements ConfigObject, Container
Class Inheritance
All Implemented Interfaces
com.typesafe.config.impl.Container, com.typesafe.config.ConfigValue, com.typesafe.config.ConfigMergeable, com.typesafe.config.ConfigObject, java.util.Map
Known Direct Subclasses
com.typesafe.config.impl.ConfigDelayedMergeObject, com.typesafe.config.impl.SimpleConfigObject
Imports
java.util.ArrayList, .Arrays, .Collection, .List, .Map, com.typesafe.config.ConfigException, .ConfigMergeable, .ConfigObject, .ConfigOrigin, .ConfigRenderOptions, .ConfigValue, .ConfigValueType

Field Summary

Modifier and TypeField and Description
private final SimpleConfig

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract AbstractConfigValue

Returns:

the value of the key, or null if known not to exist
attemptPeekWithPartialResolve
(String
key to look up
key
)

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.

public void
clear()

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).

protected AbstractConfigObject
public abstract AbstractConfigValue
get(Object
key to look up
key
)

Redeclares com.typesafe.config.ConfigObject.get.

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

protected abstract AbstractConfigObject
pack-priv static ConfigOrigin
pack-priv static ConfigOrigin
protected abstract AbstractConfigObject
protected AbstractConfigObject
protected final AbstractConfigValue

Returns:

the unmodified raw value or null
peekAssumingResolved
(String key, Path originalPath)

This looks up the key with no transformation or type conversion of any kind, and returns null if the key is not present.

protected AbstractConfigValue
peekPath(Path path)

Looks up the path with no transformation or type conversion.

private static AbstractConfigValue
public ConfigValue
put(String
key with which the specified value is to be associated
arg0
,
ConfigValue
value to be associated with the specified key
arg1
)

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).

public void
putAll(Map<? extends String, ? extends ConfigValue>
mappings to be stored in this map
arg0
)

Implements java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation).

pack-priv abstract AbstractConfigObject
relativized(final Path prefix)

Overrides 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.

public ConfigValue
remove(Object
key whose mapping is to be removed from the map
arg0
)

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).

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

Overrides com.typesafe.config.impl.AbstractConfigValue.resolveSubstitutions.

Called only by ResolveContext.resolve().

public SimpleConfig
toConfig()

Implements com.typesafe.config.ConfigObject.toConfig.

Converts this object to a Config instance, enabling you to use path expressions to find values in the object.

public AbstractConfigObject
public ConfigValueType
valueType()

Implements com.typesafe.config.ConfigValue.valueType.

The ConfigValueType of the value; matches the JSON type schema.

private static UnsupportedOperationException
public AbstractConfigObject
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.AbstractConfigValue.withFallback.

Implements com.typesafe.config.ConfigObject.withFallback, com.typesafe.config.ConfigValue.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 abstract AbstractConfigObject
withOnlyKey(String
key to keep
key
)

Redeclares com.typesafe.config.ConfigObject.withOnlyKey.

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

pack-priv abstract AbstractConfigObject
protected abstract AbstractConfigObject
public AbstractConfigObject
withOrigin(ConfigOrigin
the origin set on the returned value
origin
)

Overrides com.typesafe.config.impl.AbstractConfigValue.withOrigin.

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

Returns a ConfigValue based on this one, but with the given origin.

public abstract AbstractConfigObject
withoutKey(String
key to remove
key
)

Redeclares com.typesafe.config.ConfigObject.withoutKey.

Clone the object with the given key removed.

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

Redeclares com.typesafe.config.ConfigObject.withValue.

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

pack-priv abstract AbstractConfigObject
withValue(Path path, ConfigValue value)

Inherited from com.typesafe.config.impl.AbstractConfigValue:
appendHiddenEnvVariableValueatKeyatKeyatPathatPathcanEqualequalshasDescendantInListhashCodehideEnvVariableValueignoresFallbacksindentmergedWithNonObjectmergedWithNonObjectmergedWithObjectmergedWithTheUnmergeablemergedWithTheUnmergeableoriginrenderrenderrenderreplaceChildInListrequireNotIgnoringFallbacksresolveStatustoStringtransformToStringwithFallbacksIgnored

Field Detail

configback to summary
private final SimpleConfig config

Constructor Detail

AbstractConfigObjectback to summary
protected AbstractConfigObject(ConfigOrigin origin)

Method Detail

attemptPeekWithPartialResolveback to summary
pack-priv abstract AbstractConfigValue attemptPeekWithPartialResolve(String key)

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

Exceptions
NotResolved:
if can't figure out key's value (or existence) without more resolving
clearback to summary
public void clear()

Implements java.util.Map.clear.

Doc from java.util.Map.clear.

Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.

Annotations
@Override
constructDelayedMergeback to summary
protected AbstractConfigObject constructDelayedMerge(ConfigOrigin origin, List<AbstractConfigValue> stack)

Overrides com.typesafe.config.impl.AbstractConfigValue.constructDelayedMerge.

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

Redeclares 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
mergedWithObjectback to summary
protected abstract AbstractConfigObject mergedWithObject(AbstractConfigObject fallback)

Overrides com.typesafe.config.impl.AbstractConfigValue.mergedWithObject.

Annotations
@Override
mergeOriginsback to summary
pack-priv static ConfigOrigin mergeOrigins(Collection<? extends AbstractConfigValue> stack)
mergeOriginsback to summary
pack-priv static ConfigOrigin mergeOrigins(AbstractConfigObject... stack)
newCopyback to summary
protected abstract AbstractConfigObject newCopy(ResolveStatus status, ConfigOrigin origin)
newCopyback to summary
protected AbstractConfigObject newCopy(ConfigOrigin origin)

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

Annotations
@Override
peekAssumingResolvedback to summary
protected final AbstractConfigValue peekAssumingResolved(String key, Path originalPath)

This looks up the key with no transformation or type conversion of any kind, and returns null if the key is not present. The object must be resolved along the nodes needed to get the key or ConfigException.NotResolved will be thrown.

Returns:AbstractConfigValue

the unmodified raw value or null

peekPathback to summary
protected AbstractConfigValue peekPath(Path path)

Looks up the path with no transformation or type conversion. Returns null if the path is not found; throws ConfigException.NotResolved if we need to go through an unresolved node to look up the path.

peekPathback to summary
private static AbstractConfigValue peekPath(AbstractConfigObject self, Path path)
putback to summary
public ConfigValue put(String arg0, ConfigValue arg1)

Implements java.util.Map.put.

Doc from java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)

Parameters
arg0:String

key with which the specified value is to be associated

arg1:ConfigValue

value to be associated with the specified key

Returns:ConfigValue

the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)

Annotations
@Override
putAllback to summary
public void putAll(Map<? extends String, ? extends ConfigValue> arg0)

Implements java.util.Map.putAll.

Doc from java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress. If the specified map has a defined encounter order, processing of its mappings generally occurs in that order.

Parameters
arg0:Map<? extends String, ? extends ConfigValue>

mappings to be stored in this map

Annotations
@Override
relativizedback to summary
pack-priv abstract AbstractConfigObject relativized(final Path prefix)

Overrides com.typesafe.config.impl.AbstractConfigValue.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:AbstractConfigObject

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

Annotations
@Override
removeback to summary
public ConfigValue remove(Object arg0)

Implements java.util.Map.remove.

Doc from java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation). More formally, if this map contains a mapping from key k to value v such that Objects.equals(key, k), that mapping is removed. (The map can contain at most one such mapping.)

Returns the value to which this map previously associated the key, or null if the map contained no mapping for the key.

If this map permits null values, then a return value of null does not necessarily indicate that the map contained no mapping for the key; it's also possible that the map explicitly mapped the key to null.

The map will not contain a mapping for the specified key once the call returns.

Parameters
arg0:Object

key whose mapping is to be removed from the map

Returns:ConfigValue

the previous value associated with key, or null if there was no mapping for key.

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

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

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

Overrides com.typesafe.config.impl.AbstractConfigValue.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
toConfigback to summary
public SimpleConfig toConfig()

Implements com.typesafe.config.ConfigObject.toConfig.

Doc from com.typesafe.config.ConfigObject.toConfig.

Converts this object to a 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).

Returns:SimpleConfig

a Config with this object as its root

Annotations
@Override
toFallbackValueback to summary
public AbstractConfigObject toFallbackValue()

Overrides com.typesafe.config.impl.AbstractConfigValue.toFallbackValue.

Implements com.typesafe.config.impl.MergeableValue.toFallbackValue.

Annotations
@Override
valueTypeback to summary
public ConfigValueType valueType()

Implements com.typesafe.config.ConfigValue.valueType.

Doc from com.typesafe.config.ConfigValue.valueType.

The ConfigValueType of the value; matches the JSON type schema.

Returns:ConfigValueType

value's type

Annotations
@Override
weAreImmutableback to summary
private static UnsupportedOperationException weAreImmutable(String method)
withFallbackback to summary
public AbstractConfigObject withFallback(ConfigMergeable mergeable)

Overrides com.typesafe.config.impl.AbstractConfigValue.withFallback.

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

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

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

Redeclares 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:AbstractConfigObject

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

Annotations
@Override
withOnlyPathback to summary
pack-priv abstract AbstractConfigObject withOnlyPath(Path path)
withOnlyPathOrNullback to summary
protected abstract AbstractConfigObject withOnlyPathOrNull(Path path)
withOriginback to summary
public AbstractConfigObject withOrigin(ConfigOrigin origin)

Overrides com.typesafe.config.impl.AbstractConfigValue.withOrigin.

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

Doc from com.typesafe.config.ConfigValue.withOrigin.

Returns a ConfigValue based on this one, but with the given origin. This is useful when you are parsing a new format of file or setting comments for a single ConfigValue.

Parameters
origin:ConfigOrigin

the origin set on the returned value

Returns:AbstractConfigObject

the new ConfigValue with the given origin

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

Redeclares 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:AbstractConfigObject

a copy of the object minus the specified key

Annotations
@Override
withoutPathback to summary
pack-priv abstract AbstractConfigObject withoutPath(Path path)
withValueback to summary
public abstract AbstractConfigObject withValue(String key, ConfigValue value)

Redeclares 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:AbstractConfigObject

the new instance with the new map entry

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