public class GrailsConfig
extends java.lang.Object
Constructor and Description |
---|
GrailsConfig(GrailsApplication grailsApplication) |
Modifier and Type | Method and Description |
---|---|
<T> T |
get(java.lang.String key)
Utility method for retrieving a configuration value.
|
<T> T |
get(java.lang.String key,
java.lang.Class<T> type)
Utility method for retrieving a configuration value and performs type checking
(i.e.
|
<T> T |
get(java.lang.String key,
T defaultValue)
Configuration Value lookup with a default value.
|
<T> T |
get(java.lang.String key,
T defaultValue,
java.util.List<T> 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
GrailsConfig['my.config.key'] |
ConfigObject |
getConfig() |
java.util.Map |
getFlatConfig() |
<T> T |
getMandatory(java.lang.String key)
Configuration Value lookup with thows a GrailsConfigurationException when the value is null
|
<T> T |
getMandatory(java.lang.String key,
java.util.List<T> allowedValues)
Configuration Value lookup with thows a GrailsConfigurationException when the value is null
or not within the allowedValues.
|
public GrailsConfig(GrailsApplication grailsApplication)
public <T> T get(java.lang.String key)
T
- the type parameterkey
- the flattened keypublic <T> T get(java.lang.String key, java.lang.Class<T> type)
T
- the type parameterkey
- the flattened keytype
- the required typepublic <T> T get(java.lang.String key, T defaultValue)
T
- the type parameterkey
- the flattened keydefaultValue
- the default valuedefaultValue
public <T> T get(java.lang.String key, T defaultValue, java.util.List<T> allowedValues)
T
- the type parameterkey
- the flattened keydefaultValue
- the default valueallowedValues
- List of allowed valuesallowedValues
, otherwise the defaultValue
public <T> T getMandatory(java.lang.String key)
T
- the type parameterkey
- the flattened keypublic <T> T getMandatory(java.lang.String key, java.util.List<T> allowedValues)
T
- the type parameterkey
- the flattened keyallowedValues
- List of allowed valuespublic java.lang.Object getAt(java.lang.Object key)
GrailsConfig['my.config.key']
key
- the config keypublic java.util.Map getFlatConfig()
public ConfigObject getConfig()