Overview | Package | Class | Deprecated | Index | Help
| Groovy 1.7.6
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## groovy.util
[Groovy] Class ConfigObject

    java.lang.Object
      java.util.AbstractMap
          java.util.HashMap
              java.util.LinkedHashMap
                  groovy.util.ConfigObject

All Implemented Interfaces:
  Writable

    class ConfigObject
    extends LinkedHashMap

A ConfigObject at a simple level is a Map that creates configuration entries (other ConfigObjects) when referencing them. This means that navigating to foo.bar.stuff will not return null but nested ConfigObjects which are of course empty maps The Groovy truth can be used to check for the existance of "real" entries.

Authors:
  Graeme Rocher

Since:
  1.5

Property Summary
`static def` | `KEYWORDS`
`static def` | `TAB_CHARACTER`
`URL` | `configFile` The config file that was used when parsing this ConfigObject

Constructor Summary
`ConfigObject(URL file)`
`ConfigObject()`

Method Summary
`Map` | `flatten()` A ConfigObject is a tree structure consisting of nested maps.
`Map` | `flatten(Map target)` Flattens this ConfigObject populating the results into the target Map
`def` | `getProperty(String name)` Overrides the default getProperty implementation to create nested ConfigObject instances on demand for non-existant keys
`Map` | `merge(ConfigObject other)` Merges the given map with this ConfigObject overriding any matching configuration entries in this ConfigObject
`Properties` | `toProperties()` Converts this ConfigObject into a the java.util.Properties format, flattening the tree structure beforehand
`Properties` | `toProperties(String prefix)` Converts this ConfigObject ino the java.util.Properties format, flatten the tree and prefixing all entries with the given prefix
`Writer` | `writeTo(Writer outArg)` Writes this config object into a String serialized representation which can later be parsed back using the parse() method

Methods inherited from class LinkedHashMap
get, clear, containsValue, put, values, clone, size, isEmpty, entrySet, putAll, remove, keySet, containsKey, equals, toString, hashCode, wait, wait, wait, getClass, notify, notifyAll

Methods inherited from class HashMap
get, put, values, clone, clear, size, isEmpty, entrySet, putAll, remove, keySet, containsValue, containsKey, equals, toString, hashCode, wait, wait, wait, getClass, notify, notifyAll

Methods inherited from class AbstractMap
get, put, equals, toString, values, hashCode, clear, size, isEmpty, entrySet, putAll, remove, keySet, containsValue, containsKey, wait, wait, wait, getClass, notify, notifyAll

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

Property Detail

### KEYWORDS

    static final def KEYWORDS

### TAB_CHARACTER

    static final def TAB_CHARACTER

### configFile

    URL configFile

  The config file that was used when parsing this ConfigObject

Constructor Detail

### ConfigObject

    ConfigObject(URL file)

### ConfigObject

    ConfigObject()

Method Detail

### flatten

    Map flatten()

  A ConfigObject is a tree structure consisting of nested maps. This flattens the maps into a single level structure like a properties file

### flatten

    Map flatten(Map target)

  Flattens this ConfigObject populating the results into the target Map
  See Also:
    ConfigObject.flatten

### getProperty

    def getProperty(String name)

  Overrides the default getProperty implementation to create nested ConfigObject instances on demand for non-existant keys

### merge

    Map merge(ConfigObject other)

  Merges the given map with this ConfigObject overriding any matching configuration entries in this ConfigObject
  Parameters:
    `other` - The ConfigObject to merge with
  Returns:
    The result of the merge

### toProperties

    Properties toProperties()

  Converts this ConfigObject into a the java.util.Properties format, flattening the tree structure beforehand
  Returns:
    A java.util.Properties instance

### toProperties

    Properties toProperties(String prefix)

  Converts this ConfigObject ino the java.util.Properties format, flatten the tree and prefixing all entries with the given prefix
  Parameters:
    `prefix` - The prefix to append before property entries
  Returns:
    A java.util.Properties instance

### writeTo

    Writer writeTo(Writer outArg)

  Writes this config object into a String serialized representation which can later be parsed back using the parse() method
  See Also:
    Writable.writeTo

Copyright © 2003-2010 The Codehaus. All rights reserved.