|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.util.ConfigObject
public class ConfigObject
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
ConfigObject()
|
|
ConfigObject(URL file)
|
Method Summary | |
---|---|
void |
clear()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set |
entrySet()
|
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 |
Object |
get(Object key)
|
URL |
getConfigFile()
|
Object |
getProperty(String name)
Overrides the default getProperty implementation to create nested ConfigObject instances on demand for non-existent keys |
boolean |
isEmpty()
|
Set |
keySet()
|
Map |
merge(ConfigObject other)
Merges the given map with this ConfigObject overriding any matching configuration entries in this ConfigObject |
Object |
put(Object key,
Object value)
|
void |
putAll(Map m)
|
Object |
remove(Object key)
|
void |
setConfigFile(URL configFile)
|
int |
size()
|
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 |
Collection |
values()
|
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 groovy.lang.GroovyObjectSupport |
---|
getMetaClass, invokeMethod, setMetaClass, setProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public ConfigObject(URL file)
public ConfigObject()
Method Detail |
---|
public URL getConfigFile()
public void setConfigFile(URL configFile)
public Writer writeTo(Writer outArg) throws IOException
writeTo
in interface Writable
outArg
- the Writer to which this Writable should output its data.
IOException
- if an error occurred while outputting data to the
writerWritable.writeTo(java.io.Writer)
public Object getProperty(String name)
getProperty
in interface GroovyObject
getProperty
in class GroovyObjectSupport
name
- the name of the property of interest
public Map flatten()
public Map flatten(Map target)
flatten()
public Map merge(ConfigObject other)
other
- The ConfigObject to merge with
public Properties toProperties()
public Properties toProperties(String prefix)
prefix
- The prefix to append before property entries
public int size()
size
in interface Map
public boolean isEmpty()
isEmpty
in interface Map
public boolean containsKey(Object key)
containsKey
in interface Map
public boolean containsValue(Object value)
containsValue
in interface Map
public Object get(Object key)
get
in interface Map
public Object put(Object key, Object value)
put
in interface Map
public Object remove(Object key)
remove
in interface Map
public void putAll(Map m)
putAll
in interface Map
public void clear()
clear
in interface Map
public Set keySet()
keySet
in interface Map
public Collection values()
values
in interface Map
public Set entrySet()
entrySet
in interface Map
|
Copyright © 2003-2012 The Codehaus. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |