|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap java.util.HashMap java.util.LinkedHashMap groovy.util.ConfigObject
class ConfigObject extends java.util.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 existence of "real" entries.
Property Summary | |
---|---|
static java.lang.Object |
KEYWORDS
|
static java.lang.Object |
TAB_CHARACTER
|
java.net.URL |
configFile
The config file that was used when parsing this ConfigObject |
Constructor Summary | |
ConfigObject(java.net.URL file)
|
|
ConfigObject()
|
Method Summary | |
---|---|
java.util.Map
|
flatten()
A ConfigObject is a tree structure consisting of nested maps. |
java.util.Map
|
flatten(java.util.Map target)
Flattens this ConfigObject populating the results into the target Map |
java.lang.Object
|
getProperty(java.lang.String name)
Overrides the default getProperty implementation to create nested ConfigObject instances on demand for non-existent keys |
java.util.Map
|
merge(ConfigObject other)
Merges the given map with this ConfigObject overriding any matching configuration entries in this ConfigObject |
java.util.Properties
|
toProperties()
Converts this ConfigObject into a the java.util.Properties format, flattening the tree structure beforehand |
java.util.Properties
|
toProperties(java.lang.String prefix)
Converts this ConfigObject ino the java.util.Properties format, flatten the tree and prefixing all entries with the given prefix |
java.io.Writer
|
writeTo(java.io.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 java.util.LinkedHashMap | |
---|---|
java.util.LinkedHashMap#get(java.lang.Object), java.util.LinkedHashMap#clear(), java.util.LinkedHashMap#containsValue(java.lang.Object), java.util.LinkedHashMap#put(java.lang.Object, java.lang.Object), java.util.LinkedHashMap#values(), java.util.LinkedHashMap#clone(), java.util.LinkedHashMap#size(), java.util.LinkedHashMap#isEmpty(), java.util.LinkedHashMap#remove(java.lang.Object), java.util.LinkedHashMap#entrySet(), java.util.LinkedHashMap#putAll(java.util.Map), java.util.LinkedHashMap#keySet(), java.util.LinkedHashMap#containsKey(java.lang.Object), java.util.LinkedHashMap#equals(java.lang.Object), java.util.LinkedHashMap#toString(), java.util.LinkedHashMap#hashCode(), java.util.LinkedHashMap#wait(long), java.util.LinkedHashMap#wait(long, int), java.util.LinkedHashMap#wait(), java.util.LinkedHashMap#getClass(), java.util.LinkedHashMap#notify(), java.util.LinkedHashMap#notifyAll() |
Methods inherited from class java.util.HashMap | |
---|---|
java.util.HashMap#get(java.lang.Object), java.util.HashMap#put(java.lang.Object, java.lang.Object), java.util.HashMap#values(), java.util.HashMap#clone(), java.util.HashMap#clear(), java.util.HashMap#size(), java.util.HashMap#isEmpty(), java.util.HashMap#remove(java.lang.Object), java.util.HashMap#entrySet(), java.util.HashMap#putAll(java.util.Map), java.util.HashMap#keySet(), java.util.HashMap#containsValue(java.lang.Object), java.util.HashMap#containsKey(java.lang.Object), java.util.HashMap#equals(java.lang.Object), java.util.HashMap#toString(), java.util.HashMap#hashCode(), java.util.HashMap#wait(long), java.util.HashMap#wait(long, int), java.util.HashMap#wait(), java.util.HashMap#getClass(), java.util.HashMap#notify(), java.util.HashMap#notifyAll() |
Property Detail |
---|
static final java.lang.Object KEYWORDS
static final java.lang.Object TAB_CHARACTER
java.net.URL configFile
Constructor Detail |
---|
ConfigObject(java.net.URL file)
ConfigObject()
Method Detail |
---|
java.util.Map flatten()
java.util.Map flatten(java.util.Map target)
java.lang.Object getProperty(java.lang.String name)
java.util.Map merge(ConfigObject other)
other
- The ConfigObject to merge with
java.util.Properties toProperties()
java.util.Properties toProperties(java.lang.String prefix)
prefix
- The prefix to append before property entries
java.io.Writer writeTo(java.io.Writer outArg)
Groovy Documentation