|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.grails.commons.cfg.GrailsConfig
public class GrailsConfig extends java.lang.Object
Type safe abstraction over Grails configuration
Constructor Summary | |
GrailsConfig(GrailsApplication grailsApplication)
|
Method Summary | |
---|---|
java.lang.Object
|
get(java.lang.String key)
Utility method for retrieving a configuration value. |
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). |
java.lang.Object
|
get(java.lang.String key, java.lang.Object defaultValue)
Configuration Value lookup with a default value. |
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. |
java.lang.Object
|
getAt(java.lang.Object key)
Configuration Value lookup for Groovy's array-like property access |
groovy.util.ConfigObject
|
getConfig()
|
java.util.Map
|
getFlatConfig()
|
java.lang.Object
|
getMandatory(java.lang.String key)
Configuration Value lookup with thows a GrailsConfigurationException when the value is null |
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 java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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() |
Constructor Detail |
---|
public GrailsConfig(GrailsApplication grailsApplication)
Method Detail |
---|
@SuppressWarnings("unchecked") public java.lang.Object get(java.lang.String key)
key
- the flattened key
- the type parameter
public java.lang.Object get(java.lang.String key, java.lang.Class type)
key
- the flattened keytype
- the required type
- the type parameter
@SuppressWarnings("unchecked") public java.lang.Object get(java.lang.String key, java.lang.Object defaultValue)
key
- the flattened keydefaultValue
- the default value
- the type parameterdefaultValue
public java.lang.Object get(java.lang.String key, java.lang.Object defaultValue, java.util.List allowedValues)
key
- the flattened keydefaultValue
- the default valueallowedValues
- List of allowed values
- the type parameterallowedValues
, otherwise the defaultValue
public java.lang.Object getAt(java.lang.Object key)
GrailsConfig['my.config.key']
key
- the config key
public groovy.util.ConfigObject getConfig()
@SuppressWarnings("rawtypes") public java.util.Map getFlatConfig()
@SuppressWarnings("unchecked") public java.lang.Object getMandatory(java.lang.String key)
key
- the flattened key
- the type parameter
@SuppressWarnings("unchecked") public java.lang.Object getMandatory(java.lang.String key, java.util.List allowedValues)
key
- the flattened keyallowedValues
- List of allowed values
- the type parameter
Groovy Documentation