Overview | Package | Class | Deprecated | Index | Help
| Griffon 0.9.5-rc2
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## griffon.util
[Java] Class ConfigUtils

    java.lang.Object
      griffon.util.ConfigUtils

    public abstract class ConfigUtils
    extends Object

Utility class for reading configuration properties.

Authors:
  Andres Almiray

Constructor Summary
`ConfigUtils()`

Method Summary
`static Object` | `getConfigValue(Map config, String key)` Returns the value for the specified key.
`static Object` | `getConfigValue(Map config, String key, Object defaultValue)` Returns the value for the specified key with an optional default value if no match is found.
`static boolean` | `getConfigValueAsBoolean(Map config, String key)` Returns the value for the specified key coerced to a boolean.
`static boolean` | `getConfigValueAsBoolean(Map config, String key, boolean defaultValue)` Returns the value for the specified key with an optional default value if no match is found.
`static int` | `getConfigValueAsInt(Map config, String key)` Returns the value for the specified key coerced to an int.
`static int` | `getConfigValueAsInt(Map config, String key, int defaultValue)` Returns the value for the specified key with an optional default value if no match is found.
`static String` | `getConfigValueAsString(Map config, String key)` Returns the value for the specified key converted to a String.
`static String` | `getConfigValueAsString(Map config, String key, String defaultValue)` Returns the value for the specified key with an optional default value if no match is found.
`static boolean` | `isValueDefined(Map config, String key)` Returns true if there's a on-null value for the specified key.

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Constructor Detail

### ConfigUtils

    ConfigUtils()

Method Detail

### getConfigValue

    public static Object getConfigValue(Map config, String key)

  Returns the value for the specified key.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
  Returns:
    the value of the key. May return null

### getConfigValue

    public static Object getConfigValue(Map config, String key, Object defaultValue)

  Returns the value for the specified key with an optional default value if no match is found.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
    `defaultValue` - the value to send back if no match is found
  Returns:
    the value of the key or the default value if no match is found

### getConfigValueAsBoolean

    public static boolean getConfigValueAsBoolean(Map config, String key)

  Returns the value for the specified key coerced to a boolean.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
  Returns:
    the value of the key. Returns `false` if no match.

### getConfigValueAsBoolean

    public static boolean getConfigValueAsBoolean(Map config, String key, boolean defaultValue)

  Returns the value for the specified key with an optional default value if no match is found.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
    `defaultValue` - the value to send back if no match is found
  Returns:
    the value of the key or the default value if no match is found

### getConfigValueAsInt

    public static int getConfigValueAsInt(Map config, String key)

  Returns the value for the specified key coerced to an int.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
  Returns:
    the value of the key. Returns `0` if no match.

### getConfigValueAsInt

    public static int getConfigValueAsInt(Map config, String key, int defaultValue)

  Returns the value for the specified key with an optional default value if no match is found.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
    `defaultValue` - the value to send back if no match is found
  Returns:
    the value of the key or the default value if no match is found

### getConfigValueAsString

    public static String getConfigValueAsString(Map config, String key)

  Returns the value for the specified key converted to a String.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
  Returns:
    the value of the key. Returns `""` if no match.

### getConfigValueAsString

    public static String getConfigValueAsString(Map config, String key, String defaultValue)

  Returns the value for the specified key with an optional default value if no match is found.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
    `defaultValue` - the value to send back if no match is found
  Returns:
    the value of the key or the default value if no match is found

### isValueDefined

    public static boolean isValueDefined(Map config, String key)

  Returns true if there's a on-null value for the specified key.
  Parameters:
    `config` - the configuration object to be searched upon
    `key` - the key to be searched
  Returns:
    true if there's a value for the specified key, false otherwise

Groovy Documentation