Top Description Inners Fields Constructors Methods
com.typesafe.config.impl

pack-priv final Class SimpleConfig

extends Object
implements Config, MergeableValue, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, com.typesafe.config.impl.MergeableValue, com.typesafe.config.ConfigMergeable, com.typesafe.config.Config
Imports
java.io.ObjectStreamException, .Serializable, java.math.BigDecimal, .BigInteger, java.time.DateTimeException, .Duration, .Period, java.time.temporal.ChronoUnit, .TemporalAmount, java.util.AbstractMap, .ArrayList, .HashMap, .HashSet, .List, .Map, .Set, java.util.concurrent.TimeUnit, java.util.stream.Collectors, com.typesafe.config.Config, .ConfigException, .ConfigList, .ConfigMemorySize, .ConfigMergeable, .ConfigObject, .ConfigOrigin, .ConfigResolveOptions, .ConfigValue, .ConfigValueType

One thing to keep in mind in the future: as Collection-like APIs are added here, including iterators or size() or anything, they should be consistent with a one-level java.util.Map from paths to non-null values. Null values are not "in" the map.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private final AbstractConfigObject
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static void
private static void
pack-priv static void
private static void
private static void
private static void
private static void
pack-priv SimpleConfig
atKey(ConfigOrigin origin, String key)

public SimpleConfig
atKey(String
key to store this config at.
key
)

Implements com.typesafe.config.Config.atKey.

Places the config inside a Config at the given key.

public Config
atPath(String
path expression to store this config at.
path
)

Implements com.typesafe.config.Config.atPath.

Places the config inside another Config at the given path.

private static void
pack-priv static void
private static void
public void
checkValid(Config
a reference configuration
reference
,
String...
only validate values underneath these paths that your code module owns and understands
restrictToPaths
)

Implements com.typesafe.config.Config.checkValid.

Validates this config against a reference config, throwing an exception if it is invalid.

private static void
private static boolean
public Set<Map.Entry<String, ConfigValue>>
entrySet()

Implements com.typesafe.config.Config.entrySet.

Returns the set of path-value pairs, excluding any null values, found by recursing the root object.

public final boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

pack-priv AbstractConfigValue
find(Path pathExpression, ConfigValueType expected, Path originalPath)

pack-priv AbstractConfigValue
find(String pathExpression, ConfigValueType expected)

private static AbstractConfigValue
findKey(AbstractConfigObject self, String key, ConfigValueType expected, Path originalPath)

private static AbstractConfigValue
findKeyOrNull(AbstractConfigObject self, String key, ConfigValueType expected, Path originalPath)

private static AbstractConfigValue
findOrNull(AbstractConfigObject self, Path path, ConfigValueType expected, Path originalPath)

private AbstractConfigValue
findOrNull(Path pathExpression, ConfigValueType expected, Path originalPath)

private AbstractConfigValue
findOrNull(String pathExpression, ConfigValueType expected)

private static void
public Object
getAnyRef(String
path expression
path
)

Implements com.typesafe.config.Config.getAnyRef.

Gets the value at the path as an unwrapped Java boxed value ( Boolean, Integer, and so on - see ConfigValue#unwrapped()).

public List<? extends Object>
getAnyRefList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getAnyRefList.

Gets a list value with any kind of elements.

public boolean
public List<Boolean>
getBooleanList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getBooleanList.

Gets a list value with boolean elements.

public Long
getBytes(String
path expression
path
)

Implements com.typesafe.config.Config.getBytes.

Gets a value as a size in bytes (parses special strings like "128M").

private BigInteger
public List<Long>
getBytesList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getBytesList.

Gets a list value with elements representing a size in bytes.

private List<BigInteger>
public SimpleConfig
getConfig(String
path expression
path
)

Implements com.typesafe.config.Config.getConfig.

public List<? extends Config>
getConfigList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getConfigList.

Gets a list value with Config elements.

private ConfigNumber
private static String
private static String
getDesc(ConfigValue refValue)

public double
getDouble(String
path expression
path
)

Implements com.typesafe.config.Config.getDouble.

public List<Double>
getDoubleList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getDoubleList.

Gets a list value with double elements.

public long
getDuration(String
path expression
path
,
TimeUnit
convert the return value to this time unit
unit
)

Implements com.typesafe.config.Config.getDuration.

Gets a value as a duration in a specified TimeUnit.

public Duration
getDuration(String
path expression
path
)

Implements com.typesafe.config.Config.getDuration.

Gets a value as a java.time.Duration.

public List<Long>
getDurationList(String
a path expression
path
,
TimeUnit
time units of the returned values
unit
)

Implements com.typesafe.config.Config.getDurationList.

Gets a list, converting each value in the list to a duration, using the same rules as getDuration(String, TimeUnit).

public List<Duration>
getDurationList(String
a path expression
path
)

Implements com.typesafe.config.Config.getDurationList.

Gets a list, converting each value in the list to a duration, using the same rules as getDuration(String).

public <T extends Enum<T>> T
getEnum(Class<T>
an enum class
enumClass
,
String
path expression
path
)

Implements com.typesafe.config.Config.getEnum.

public <T extends Enum<T>> List<T>
getEnumList(Class<T>
the enum class
enumClass
,
String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getEnumList.

Gets a list value with Enum elements.

private <T extends Enum<T>> T
getEnumValue(String path, Class<T> enumClass, ConfigValue enumConfigValue)

private <T> List<T>
private <T extends ConfigValue> List<T>
public int
getInt(String
path expression
path
)

Implements com.typesafe.config.Config.getInt.

Gets the integer at the given path.

public List<Integer>
getIntList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getIntList.

Gets a list value with int elements.

public boolean
getIsNull(String
the path expression
path
)

Implements com.typesafe.config.Config.getIsNull.

Checks whether a value is set to null at the given path, but throws an exception if the value is entirely unset.

public ConfigList
getList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getList.

Gets a list value (with any element type) as a ConfigList, which implements java.util.List<ConfigValue>.

public long
getLong(String
path expression
path
)

Implements com.typesafe.config.Config.getLong.

Gets the long integer at the given path.

public List<Long>
getLongList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getLongList.

Gets a list value with long elements.

public ConfigMemorySize
getMemorySize(String
path expression
path
)

Implements com.typesafe.config.Config.getMemorySize.

Gets a value as an amount of memory (parses special strings like "128M").

public List<ConfigMemorySize>
getMemorySizeList(String
a path expression
path
)

Implements com.typesafe.config.Config.getMemorySizeList.

Gets a list, converting each value in the list to a memory size, using the same rules as getMemorySize(String).

public Long
getMilliseconds(String
path expression
path
)

Implements com.typesafe.config.Config.getMilliseconds.

Deprecated

Get value as a duration in milliseconds.

public List<Long>
public Long
getNanoseconds(String
path expression
path
)

Implements com.typesafe.config.Config.getNanoseconds.

Deprecated

Get value as a duration in nanoseconds.

public List<Long>
public Number
getNumber(String
path expression
path
)

Implements com.typesafe.config.Config.getNumber.

public List<Number>
getNumberList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getNumberList.

Gets a list value with number elements.

public AbstractConfigObject
getObject(String
path expression
path
)

Implements com.typesafe.config.Config.getObject.

public List<ConfigObject>
getObjectList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getObjectList.

Gets a list value with object elements.

public Period
getPeriod(String
path expression
path
)

Implements com.typesafe.config.Config.getPeriod.

Gets a value as a java.time.Period.

public String
getString(String
path expression
path
)

Implements com.typesafe.config.Config.getString.

public List<String>
getStringList(String
the path to the list value.
path
)

Implements com.typesafe.config.Config.getStringList.

Gets a list value with string elements.

public TemporalAmount
getTemporal(String
path expression
path
)

Implements com.typesafe.config.Config.getTemporal.

Gets a value as a java.time.temporal.TemporalAmount.

private static String
public AbstractConfigValue
getValue(String
path expression
path
)

Implements com.typesafe.config.Config.getValue.

Gets the value at the given path, unless the value is a null value or missing, in which case it throws just like the other getters.

public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
hasPath(String
the path expression
pathExpression
)

Implements com.typesafe.config.Config.hasPath.

Checks whether a value is present and non-null at the given path.

public boolean
hasPathOrNull(String
the path expression
path
)

Implements com.typesafe.config.Config.hasPathOrNull.

Checks whether a value is present at the given path, even if the value is null.

private ConfigValue
hasPathPeek(String pathExpression)

private static boolean
private static boolean
public boolean
isEmpty()

Implements com.typesafe.config.Config.isEmpty.

Returns true if the Config's root object contains no key-value pairs.

public boolean
isResolved()

Implements com.typesafe.config.Config.isResolved.

Checks whether the config is completely resolved.

public ConfigOrigin
origin()

Implements com.typesafe.config.Config.origin.

Gets the origin of the Config, which may be a file, or a file with a line number, or just a descriptive phrase.

public static BigInteger

Returns:

size in bytes
parseBytes
(String
the string to parse
input
,
ConfigOrigin
origin of the value being parsed
originForException
,
String
path to include in exceptions
pathForException
)

Parses a size-in-bytes string.

public static long

Returns:

duration in nanoseconds
parseDuration
(String
the string to parse
input
,
ConfigOrigin
origin of the value being parsed
originForException
,
String
path to include in exceptions
pathForException
)

Parses a duration string.

public static Period

Returns:

duration in days
parsePeriod
(String
the string to parse
input
,
ConfigOrigin
origin of the value being parsed
originForException
,
String
path to include in exceptions
pathForException
)

Parses a period string.

private AbstractConfigValue
peekPath(Path path)

private static Period
periodOf(int n, ChronoUnit unit)

public SimpleConfig
resolve()

Implements com.typesafe.config.Config.resolve.

Returns a replacement config with all substitutions (the ${foo.bar} syntax, see the spec) resolved.

public SimpleConfig
resolve(ConfigResolveOptions
resolve options
options
)

Implements com.typesafe.config.Config.resolve.

Like Config#resolve() but allows you to specify non-default options.

public SimpleConfig
resolveWith(Config
configuration to pull values from
source
)

Implements com.typesafe.config.Config.resolveWith.

Like Config#resolve() except that substitution values are looked up in the given source, rather than in this instance.

public SimpleConfig
resolveWith(Config
source configuration to pull values from
source
,
ConfigResolveOptions
resolve options
options
)

Implements com.typesafe.config.Config.resolveWith.

Like Config#resolveWith(Config) but allows you to specify non-default options.

public AbstractConfigObject
root()

Implements com.typesafe.config.Config.root.

Gets the Config as a tree of ConfigObject.

private static AbstractConfigValue
public AbstractConfigObject
private Long
toLong(BigInteger value, ConfigOrigin originForException, String pathForException)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

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

Implements com.typesafe.config.Config.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 SimpleConfig
withOnlyPath(String
path to keep
pathExpression
)

Implements com.typesafe.config.Config.withOnlyPath.

Clone the config with only the given path (and its children) retained; all sibling paths are removed.

public SimpleConfig
withoutPath(String
path expression to remove
pathExpression
)

Implements com.typesafe.config.Config.withoutPath.

Clone the config with the given path removed.

public SimpleConfig
withValue(String
path expression for the value's new location
pathExpression
,
ConfigValue
value at the new path
v
)

Implements com.typesafe.config.Config.withValue.

Returns a Config based on this one, but with the given path set to the given value.

private Object
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait