public class Configuration
extends java.lang.Object
Constructor and Description |
---|
Configuration(com.typesafe.config.Config conf)
Creates a new configuration from a Typesafe Config object.
|
Configuration(play.api.Configuration conf)
Creates a new configuration from a Scala-based configuration.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
asMap()
Returns the config as a map of plain old Java maps, lists and values.
|
java.util.Set<java.util.Map.Entry<java.lang.String,com.typesafe.config.ConfigValue>> |
entrySet()
Returns the config as a set of full paths to config values.
|
java.lang.Boolean |
getBoolean(java.lang.String key)
Retrieves a configuration value as a
Boolean . |
java.lang.Boolean |
getBoolean(java.lang.String key,
java.lang.Boolean defaultBoolean)
Retrieves a configuration value as a
Boolean . |
java.util.List<java.lang.Boolean> |
getBooleanList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<java.lang.Boolean> |
getBooleanList(java.lang.String key,
java.util.List<java.lang.Boolean> defaultList)
Retrieves a configuration value as a
List . |
java.lang.Long |
getBytes(java.lang.String key)
Retrieves a configuration value as a
Bytes . |
java.lang.Long |
getBytes(java.lang.String key,
java.lang.Long defaultBytes)
Retrieves a configuration value as a
Bytes . |
java.util.List<java.lang.Long> |
getBytesList(java.lang.String key)
Retrieves a configuration value as a
List representing bytes. |
java.util.List<java.lang.Long> |
getBytesList(java.lang.String key,
java.util.List<java.lang.Long> defaultList)
Retrieves a configuration value as a
List representing bytes. |
Configuration |
getConfig(java.lang.String key)
Retrieves a sub-configuration, which is a configuration instance containing all keys that start with the given prefix.
|
java.util.List<Configuration> |
getConfigList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<Configuration> |
getConfigList(java.lang.String key,
java.util.List<Configuration> defaultList)
Retrieves a configuration value as a
List . |
java.lang.Double |
getDouble(java.lang.String key)
Retrieves a configuration value as an
Double . |
java.lang.Double |
getDouble(java.lang.String key,
java.lang.Double defaultDouble)
Retrieves a configuration value as an
Double . |
java.util.List<java.lang.Double> |
getDoubleList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<java.lang.Double> |
getDoubleList(java.lang.String key,
java.util.List<java.lang.Double> defaultList)
Retrieves a configuration value as a
List . |
java.lang.Integer |
getInt(java.lang.String key)
Retrieves a configuration value as an
Int . |
java.lang.Integer |
getInt(java.lang.String key,
java.lang.Integer defaultInteger)
Retrieves a configuration value as an
Int . |
java.util.List<java.lang.Integer> |
getIntList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<java.lang.Integer> |
getIntList(java.lang.String key,
java.util.List<java.lang.Integer> defaultList)
Retrieves a configuration value as a
List . |
java.util.List<java.lang.Object> |
getList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<java.lang.Object> |
getList(java.lang.String key,
java.util.List<java.lang.Object> defaultList)
Retrieves a configuration value as a
List . |
java.lang.Long |
getLong(java.lang.String key)
Retrieves a configuration value as an
Long . |
java.lang.Long |
getLong(java.lang.String key,
java.lang.Long defaultLong)
Retrieves a configuration value as an
Long . |
java.util.List<java.lang.Long> |
getLongList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<java.lang.Long> |
getLongList(java.lang.String key,
java.util.List<java.lang.Long> defaultList)
Retrieves a configuration value as a
List . |
java.lang.Long |
getMilliseconds(java.lang.String key)
Retrieves a configuration value as a
Milliseconds . |
java.lang.Long |
getMilliseconds(java.lang.String key,
java.lang.Long defaultMilliseconds)
Retrieves a configuration value as a
Milliseconds . |
java.util.List<java.lang.Long> |
getMillisecondsList(java.lang.String key)
Retrieves a configuration value as a
List representing Milliseconds. |
java.util.List<java.lang.Long> |
getMillisecondsList(java.lang.String key,
java.util.List<java.lang.Long> defaultList)
Retrieves a configuration value as a
List representing Milliseconds. |
java.lang.Long |
getNanoseconds(java.lang.String key)
Retrieves a configuration value as a
Nanoseconds . |
java.lang.Long |
getNanoseconds(java.lang.String key,
java.lang.Long defaultNanoseconds)
Retrieves a configuration value as a
Nanoseconds . |
java.util.List<java.lang.Long> |
getNanosecondsList(java.lang.String key)
Retrieves a configuration value as a
List representing Nanoseconds. |
java.util.List<java.lang.Long> |
getNanosecondsList(java.lang.String key,
java.util.List<java.lang.Long> defaultList)
Retrieves a configuration value as a
List representing Nanoseconds. |
java.lang.Number |
getNumber(java.lang.String key)
Retrieves a configuration value as an
Number . |
java.lang.Number |
getNumber(java.lang.String key,
java.lang.Number defaultNumber)
Retrieves a configuration value as an
Number . |
java.util.List<java.lang.Number> |
getNumberList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<java.lang.Number> |
getNumberList(java.lang.String key,
java.util.List<java.lang.Number> defaultList)
Retrieves a configuration value as a
List . |
java.lang.Object |
getObject(java.lang.String key)
Retrieves a configuration value as a
Object . |
java.lang.Object |
getObject(java.lang.String key,
java.lang.Object defaultObject)
Retrieves a configuration value as a
Object . |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getObjectList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getObjectList(java.lang.String key,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> defaultList)
Retrieves a configuration value as a
List . |
java.lang.String |
getString(java.lang.String key)
Retrieves a configuration value as a
String . |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultString)
Retrieves a configuration value as a
String . |
java.util.List<java.lang.String> |
getStringList(java.lang.String key)
Retrieves a configuration value as a
List . |
java.util.List<java.lang.String> |
getStringList(java.lang.String key,
java.util.List<java.lang.String> defaultList)
Retrieves a configuration value as a
List . |
play.api.Configuration |
getWrappedConfiguration() |
java.util.Set<java.lang.String> |
keys()
Retrieves the set of keys available in this configuration.
|
java.lang.RuntimeException |
reportError(java.lang.String key,
java.lang.String message,
java.lang.Throwable e)
Creates a configuration error for a specific congiguration key.
|
static Configuration |
root()
The root configuration.
|
java.util.Set<java.lang.String> |
subKeys()
Retrieves the set of direct sub-keys available in this configuration.
|
public Configuration(com.typesafe.config.Config conf)
public Configuration(play.api.Configuration conf)
public static Configuration root()
public Configuration getConfig(java.lang.String key)
key
- The root prefix for this sub configuration.public java.lang.String getString(java.lang.String key)
String
.key
- configuration key (relative to configuration root key)null
public java.lang.String getString(java.lang.String key, java.lang.String defaultString)
String
.key
- configuration key (relative to configuration root key)defaultString
- default value if configuration key doesn't existpublic java.lang.Long getMilliseconds(java.lang.String key)
Milliseconds
.key
- configuration key (relative to configuration root key)null
public java.lang.Long getMilliseconds(java.lang.String key, java.lang.Long defaultMilliseconds)
Milliseconds
.key
- configuration key (relative to configuration root key)defaultMilliseconds
- default value if configuration key doesn't existpublic java.lang.Long getNanoseconds(java.lang.String key)
Nanoseconds
.key
- configuration key (relative to configuration root key)null
public java.lang.Long getNanoseconds(java.lang.String key, java.lang.Long defaultNanoseconds)
Nanoseconds
.key
- configuration key (relative to configuration root key)defaultNanoseconds
- default value if configuration key doesn't existpublic java.lang.Long getBytes(java.lang.String key)
Bytes
.key
- configuration key (relative to configuration root key)null
public java.lang.Long getBytes(java.lang.String key, java.lang.Long defaultBytes)
Bytes
.key
- configuration key (relative to configuration root key)defaultBytes
- default value if configuration key doesn't existpublic java.lang.Double getDouble(java.lang.String key)
Double
.key
- configuration key (relative to configuration root key)null
public java.lang.Double getDouble(java.lang.String key, java.lang.Double defaultDouble)
Double
.key
- configuration key (relative to configuration root key)defaultDouble
- default value if configuration key doesn't existpublic java.lang.Integer getInt(java.lang.String key)
Int
.key
- configuration key (relative to configuration root key)null
public java.lang.Integer getInt(java.lang.String key, java.lang.Integer defaultInteger)
Int
.key
- configuration key (relative to configuration root key)defaultInteger
- default value if configuration key doesn't existpublic java.lang.Long getLong(java.lang.String key)
Long
.key
- configuration key (relative to configuration root key)null
public java.lang.Long getLong(java.lang.String key, java.lang.Long defaultLong)
Long
.key
- configuration key (relative to configuration root key)defaultLong
- default value if configuration key doesn't existpublic java.lang.Number getNumber(java.lang.String key)
Number
.key
- configuration key (relative to configuration root key)null
public java.lang.Number getNumber(java.lang.String key, java.lang.Number defaultNumber)
Number
.key
- configuration key (relative to configuration root key)defaultLong
- default value if configuration key doesn't existpublic java.lang.Boolean getBoolean(java.lang.String key)
Boolean
.key
- configuration key (relative to configuration root key)null
public java.lang.Boolean getBoolean(java.lang.String key, java.lang.Boolean defaultBoolean)
Boolean
.key
- configuration key (relative to configuration root key)defaultBoolean
- default value if configuration key doesn't existpublic java.util.Set<java.lang.String> keys()
public java.util.Set<java.lang.String> subKeys()
public java.util.Map<java.lang.String,java.lang.Object> asMap()
public java.util.Set<java.util.Map.Entry<java.lang.String,com.typesafe.config.ConfigValue>> entrySet()
asMap()
in that it returns ConfigValue
objects, and keys are recursively expanded to be pull path keys.public java.lang.RuntimeException reportError(java.lang.String key, java.lang.String message, java.lang.Throwable e)
key
- the configuration key, related to this errormessage
- the error messagee
- the optional related exceptionpublic java.util.List<java.lang.Boolean> getBooleanList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Boolean> getBooleanList(java.lang.String key, java.util.List<java.lang.Boolean> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.Long> getBytesList(java.lang.String key)
List
representing bytes.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Long> getBytesList(java.lang.String key, java.util.List<java.lang.Long> defaultList)
List
representing bytes.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<Configuration> getConfigList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<Configuration> getConfigList(java.lang.String key, java.util.List<Configuration> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.Double> getDoubleList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Double> getDoubleList(java.lang.String key, java.util.List<java.lang.Double> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.Integer> getIntList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Integer> getIntList(java.lang.String key, java.util.List<java.lang.Integer> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.Object> getList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Object> getList(java.lang.String key, java.util.List<java.lang.Object> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.Long> getLongList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Long> getLongList(java.lang.String key, java.util.List<java.lang.Long> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.Long> getMillisecondsList(java.lang.String key)
List
representing Milliseconds.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Long> getMillisecondsList(java.lang.String key, java.util.List<java.lang.Long> defaultList)
List
representing Milliseconds.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.Long> getNanosecondsList(java.lang.String key)
List
representing Nanoseconds.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Long> getNanosecondsList(java.lang.String key, java.util.List<java.lang.Long> defaultList)
List
representing Nanoseconds.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.Number> getNumberList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.Number> getNumberList(java.lang.String key, java.util.List<java.lang.Number> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getObjectList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getObjectList(java.lang.String key, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.util.List<java.lang.String> getStringList(java.lang.String key)
List
.key
- configuration key (relative to configuration root key)null
public java.util.List<java.lang.String> getStringList(java.lang.String key, java.util.List<java.lang.String> defaultList)
List
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic java.lang.Object getObject(java.lang.String key)
Object
.key
- configuration key (relative to configuration root key)null
public java.lang.Object getObject(java.lang.String key, java.lang.Object defaultObject)
Object
.key
- configuration key (relative to configuration root key)defaultList
- default value if configuration key doesn't existpublic play.api.Configuration getWrappedConfiguration()