Type safe abstraction over Grails configuration
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
SPRING_PLACEHOLDER_PREFIX |
Constructor and description |
---|
GrailsConfig
(GrailsApplication grailsApplication) |
Type Params | Return Type | Name 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. logs a verbose WARN message on type mismatch). |
<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'] |
|
groovy.util.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. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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() |
Utility method for retrieving a configuration value.
key
- the flattened key
- the type parameterUtility method for retrieving a configuration value and performs type checking (i.e. logs a verbose WARN message on type mismatch).
key
- the flattened keytype
- the required type
- the type parameterConfiguration Value lookup with a default value.
key
- the flattened keydefaultValue
- the default value
- the type parameterdefaultValue
Configuration Value lookup with a default value and a list of allowed values.
key
- the flattened keydefaultValue
- the default valueallowedValues
- List of allowed values
- the type parameterallowedValues
, otherwise the defaultValue
Configuration Value lookup for Groovy's array-like property access GrailsConfig['my.config.key']
key
- the config keyConfiguration Value lookup with thows a GrailsConfigurationException when the value is null
key
- the flattened key
- the type parameterConfiguration Value lookup with thows a GrailsConfigurationException when the value is null or not within the allowedValues.
key
- the flattened keyallowedValues
- List of allowed values
- the type parameter