Groovy Documentation

grails.util
[Java] Class GrailsConfig

java.lang.Object
  groovy.lang.GroovyObjectSupport
      grails.util.GrailsConfig

@Deprecated
@SuppressWarnings("rawtypes")
public class GrailsConfig
extends groovy.lang.GroovyObjectSupport

General purpose Grails Configuration Utility for retieving configuration options with the ability to log warnings on type/constraint mismatch.

deprecated:
Use instead
Authors:
Siegfried Puchbauer
Since:
1.1


Method Summary
static java.lang.Object get(java.lang.String key)

Utility method for retrieving a configuration value.

static java.lang.Object get(java.lang.String key, java.lang.Class type)

Utility method for retrieving a configuration value and performs type checking (i.e. logs a verbose WARN message on type mismatch).

static java.lang.Object get(java.lang.String key, java.lang.Object defaultValue)

Configuration Value lookup with a default value.

static java.lang.Object get(java.lang.String key, java.lang.Object defaultValue, java.util.List allowedValues)

Configuration Value lookup with a default value and a list of allowed values.

static java.lang.Object getAt(java.lang.Object key)

Configuration Value lookup for Groovy's array-like property access GrailsConfig['my.config.key']

static java.lang.Object getMandatory(java.lang.String key)

Configuration Value lookup with thows a GrailsConfigurationException when the value is null

static java.lang.Object getMandatory(java.lang.String key, java.util.List allowedValues)

Configuration Value lookup with thows a GrailsConfigurationException when the value is null or not within the allowedValues.

 
Methods inherited from class groovy.lang.GroovyObjectSupport
groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll()
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

get

public static  T get(String key) {
public static java.lang.Object get(java.lang.String key)
Utility method for retrieving a configuration value.
Parameters:
key - the flattened key
- the type parameter
Returns:
the value retrieved by ConfigurationHolder.flatConfig


get

public static java.lang.Object get(java.lang.String key, java.lang.Class type)
Utility method for retrieving a configuration value and performs type checking (i.e. logs a verbose WARN message on type mismatch).
Parameters:
key - the flattened key
type - the required type
- the type parameter
Returns:
the value retrieved by ConfigurationHolder.flatConfig


get

public static  T get(String key, T defaultValue) {
public static java.lang.Object get(java.lang.String key, java.lang.Object defaultValue)
Configuration Value lookup with a default value.
Parameters:
key - the flattened key
defaultValue - the default value
- the type parameter
Returns:
the value retrieved by ConfigurationHolder.flatConfig if not null, otherwise the defaultValue


get

public static java.lang.Object get(java.lang.String key, java.lang.Object defaultValue, java.util.List allowedValues)
Configuration Value lookup with a default value and a list of allowed values.
Parameters:
key - the flattened key
defaultValue - the default value
allowedValues - List of allowed values
- the type parameter
Returns:
the value retrieved by ConfigurationHolder.flatConfig, if it is contained in allowedValues, otherwise the defaultValue


getAt

public static java.lang.Object getAt(java.lang.Object key)
Configuration Value lookup for Groovy's array-like property access GrailsConfig['my.config.key']
Parameters:
key - the config key
Returns:
the configured value


getMandatory

public static  T getMandatory(String key) {
public static java.lang.Object getMandatory(java.lang.String key)
Configuration Value lookup with thows a GrailsConfigurationException when the value is null
Parameters:
key - the flattened key
- the type parameter
Returns:
the value retrieved by ConfigurationHolder.flatConfig


getMandatory

public static  T getMandatory(String key, List allowedValues) {
public static java.lang.Object getMandatory(java.lang.String key, java.util.List allowedValues)
Configuration Value lookup with thows a GrailsConfigurationException when the value is null or not within the allowedValues.
Parameters:
key - the flattened key
allowedValues - List of allowed values
- the type parameter
Returns:
the value retrieved by ConfigurationHolder.flatConfig


 

Groovy Documentation