play
Class Configuration

java.lang.Object
  extended by play.Configuration

public class Configuration
extends java.lang.Object

The current application configuration.


Constructor Summary
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.
 
Method Summary
 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<Boolean>.
 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<Boolean>.
 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<Long> 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<Long> 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<Configuration>.
 java.util.List<Configuration> getConfigList(java.lang.String key, java.util.List<Configuration> defaultList)
          Retrieves a configuration value as a List<Configuration>.
 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<Double>.
 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<Double>.
 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<Integer>.
 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<Integer>.
 java.util.List<java.lang.Object> getList(java.lang.String key)
          Retrieves a configuration value as a List<Object>.
 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<Object>.
 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<Long>.
 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<Long>.
 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<Long> 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<Long> 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<Long> 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<Long> 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<Number>.
 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<Number>.
 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<Map<String, Object>>.
 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<Map<String, Object>>.
 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<String>.
 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<Number>.
 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 configuration 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.
 com.typesafe.config.Config underlying()
          Returns the underlying Typesafe config object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration(com.typesafe.config.Config conf)
Creates a new configuration from a Typesafe Config object.


Configuration

public Configuration(play.api.Configuration conf)
Creates a new configuration from a Scala-based configuration.

Method Detail

root

public static Configuration root()
The root configuration.

Returns:
a Configuration instance

getConfig

public Configuration getConfig(java.lang.String key)
Retrieves a sub-configuration, which is a configuration instance containing all keys that start with the given prefix.

Parameters:
key - The root prefix for this sub configuration.
Returns:
Maybe a new configuration

getString

public java.lang.String getString(java.lang.String key)
Retrieves a configuration value as a String.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultString)
Retrieves a configuration value as a String.

Parameters:
key - configuration key (relative to configuration root key)
defaultString - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultString

getMilliseconds

public java.lang.Long getMilliseconds(java.lang.String key)
Retrieves a configuration value as a Milliseconds.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getMilliseconds

public java.lang.Long getMilliseconds(java.lang.String key,
                                      java.lang.Long defaultMilliseconds)
Retrieves a configuration value as a Milliseconds.

Parameters:
key - configuration key (relative to configuration root key)
defaultMilliseconds - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultMilliseconds

getNanoseconds

public java.lang.Long getNanoseconds(java.lang.String key)
Retrieves a configuration value as a Nanoseconds.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getNanoseconds

public java.lang.Long getNanoseconds(java.lang.String key,
                                     java.lang.Long defaultNanoseconds)
Retrieves a configuration value as a Nanoseconds.

Parameters:
key - configuration key (relative to configuration root key)
defaultNanoseconds - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultMilliseconds

getBytes

public java.lang.Long getBytes(java.lang.String key)
Retrieves a configuration value as a Bytes.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getBytes

public java.lang.Long getBytes(java.lang.String key,
                               java.lang.Long defaultBytes)
Retrieves a configuration value as a Bytes.

Parameters:
key - configuration key (relative to configuration root key)
defaultBytes - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultBytes

getDouble

public java.lang.Double getDouble(java.lang.String key)
Retrieves a configuration value as an Double.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getDouble

public java.lang.Double getDouble(java.lang.String key,
                                  java.lang.Double defaultDouble)
Retrieves a configuration value as an Double.

Parameters:
key - configuration key (relative to configuration root key)
defaultDouble - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultInteger

getInt

public java.lang.Integer getInt(java.lang.String key)
Retrieves a configuration value as an Int.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getInt

public java.lang.Integer getInt(java.lang.String key,
                                java.lang.Integer defaultInteger)
Retrieves a configuration value as an Int.

Parameters:
key - configuration key (relative to configuration root key)
defaultInteger - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultInteger

getLong

public java.lang.Long getLong(java.lang.String key)
Retrieves a configuration value as an Long.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getLong

public java.lang.Long getLong(java.lang.String key,
                              java.lang.Long defaultLong)
Retrieves a configuration value as an Long.

Parameters:
key - configuration key (relative to configuration root key)
defaultLong - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultInteger

getNumber

public java.lang.Number getNumber(java.lang.String key)
Retrieves a configuration value as an Number.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getNumber

public java.lang.Number getNumber(java.lang.String key,
                                  java.lang.Number defaultNumber)
Retrieves a configuration value as an Number.

Parameters:
key - configuration key (relative to configuration root key)
defaultNumber - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultInteger

getBoolean

public java.lang.Boolean getBoolean(java.lang.String key)
Retrieves a configuration value as a Boolean.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getBoolean

public java.lang.Boolean getBoolean(java.lang.String key,
                                    java.lang.Boolean defaultBoolean)
Retrieves a configuration value as a Boolean.

Parameters:
key - configuration key (relative to configuration root key)
defaultBoolean - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultBoolean

keys

public java.util.Set<java.lang.String> keys()
Retrieves the set of keys available in this configuration.

Returns:
the set of keys available in this configuration

subKeys

public java.util.Set<java.lang.String> subKeys()
Retrieves the set of direct sub-keys available in this configuration.

Returns:
the set of direct sub-keys available in this configuration

asMap

public java.util.Map<java.lang.String,java.lang.Object> asMap()
Returns the config as a map of plain old Java maps, lists and values.

Returns:
The config map

underlying

public com.typesafe.config.Config underlying()
Returns the underlying Typesafe config object.

Returns:
The config

entrySet

public 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. This is different to asMap() in that it returns ConfigValue objects, and keys are recursively expanded to be pull path keys.

Returns:
The config as an entry set

reportError

public java.lang.RuntimeException reportError(java.lang.String key,
                                              java.lang.String message,
                                              java.lang.Throwable e)
Creates a configuration error for a specific configuration key.

Parameters:
key - the configuration key, related to this error
message - the error message
e - the optional related exception
Returns:
a configuration exception

getBooleanList

public java.util.List<java.lang.Boolean> getBooleanList(java.lang.String key)
Retrieves a configuration value as a List<Boolean>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getBooleanList

public 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<Boolean>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getBytesList

public java.util.List<java.lang.Long> getBytesList(java.lang.String key)
Retrieves a configuration value as a List<Long> representing bytes.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getBytesList

public 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<Long> representing bytes.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getConfigList

public java.util.List<Configuration> getConfigList(java.lang.String key)
Retrieves a configuration value as a List<Configuration>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getConfigList

public java.util.List<Configuration> getConfigList(java.lang.String key,
                                                   java.util.List<Configuration> defaultList)
Retrieves a configuration value as a List<Configuration>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getDoubleList

public java.util.List<java.lang.Double> getDoubleList(java.lang.String key)
Retrieves a configuration value as a List<Double>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getDoubleList

public 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<Double>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getIntList

public java.util.List<java.lang.Integer> getIntList(java.lang.String key)
Retrieves a configuration value as a List<Integer>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getIntList

public 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<Integer>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getList

public java.util.List<java.lang.Object> getList(java.lang.String key)
Retrieves a configuration value as a List<Object>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getList

public 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<Object>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getLongList

public java.util.List<java.lang.Long> getLongList(java.lang.String key)
Retrieves a configuration value as a List<Long>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getLongList

public 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<Long>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getMillisecondsList

public java.util.List<java.lang.Long> getMillisecondsList(java.lang.String key)
Retrieves a configuration value as a List<Long> representing Milliseconds.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getMillisecondsList

public 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<Long> representing Milliseconds.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getNanosecondsList

public java.util.List<java.lang.Long> getNanosecondsList(java.lang.String key)
Retrieves a configuration value as a List<Long> representing Nanoseconds.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getNanosecondsList

public 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<Long> representing Nanoseconds.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getNumberList

public java.util.List<java.lang.Number> getNumberList(java.lang.String key)
Retrieves a configuration value as a List<Number>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getNumberList

public 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<Number>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getObjectList

public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getObjectList(java.lang.String key)
Retrieves a configuration value as a List<Map<String, Object>>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getObjectList

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)
Retrieves a configuration value as a List<Map<String, Object>>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getStringList

public java.util.List<java.lang.String> getStringList(java.lang.String key)
Retrieves a configuration value as a List<String>.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getStringList

public 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<Number>.

Parameters:
key - configuration key (relative to configuration root key)
defaultList - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getObject

public java.lang.Object getObject(java.lang.String key)
Retrieves a configuration value as a Object.

Parameters:
key - configuration key (relative to configuration root key)
Returns:
a configuration value or null

getObject

public java.lang.Object getObject(java.lang.String key,
                                  java.lang.Object defaultObject)
Retrieves a configuration value as a Object.

Parameters:
key - configuration key (relative to configuration root key)
defaultObject - default value if configuration key doesn't exist
Returns:
a configuration value or the defaultList

getWrappedConfiguration

public play.api.Configuration getWrappedConfiguration()