play

Class Configuration

    • 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)
        defaultLong - 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
      • 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 congiguration 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.
        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.
        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 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 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.
        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.
        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.
        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.
        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.
        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.
        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.
        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.
          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.
            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.
            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 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 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 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 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.
            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.
            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>.
            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>.
            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.
            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.
            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)
            defaultList - default value if configuration key doesn't exist
            Returns:
            a configuration value or the defaultList
          • getWrappedConfiguration

            public play.api.Configuration getWrappedConfiguration()