|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport groovy.util.ConfigObject
public class ConfigObject extends GroovyObjectSupport
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.
Constructor Summary | |
ConfigObject(java.net.URL file)
|
|
ConfigObject()
|
Method Summary | |
---|---|
void
|
clear()
|
ConfigObject
|
clone()
Returns a shallow copy of this ConfigObject, keys and configuration entries are not cloned. |
boolean
|
containsKey(java.lang.Object key)
|
boolean
|
containsValue(java.lang.Object value)
|
java.util.Set
|
entrySet()
|
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
|
get(java.lang.Object key)
|
java.net.URL
|
getConfigFile()
|
java.lang.Object
|
getProperty(java.lang.String name)
Overrides the default getProperty implementation to create nested ConfigObject instances on demand for non-existent keys |
boolean
|
isEmpty()
|
java.util.Set
|
keySet()
|
java.util.Map
|
merge(ConfigObject other)
Merges the given map with this ConfigObject overriding any matching configuration entries in this ConfigObject |
java.lang.Object
|
put(java.lang.Object key, java.lang.Object value)
|
void
|
putAll(java.util.Map m)
|
java.lang.Object
|
remove(java.lang.Object key)
|
void
|
setConfigFile(java.net.URL configFile)
|
int
|
size()
|
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.util.Collection
|
values()
|
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 GroovyObjectSupport | |
---|---|
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty |
Methods inherited from 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() |
Constructor Detail |
---|
public ConfigObject(java.net.URL file)
public ConfigObject()
Method Detail |
---|
public void clear()
public ConfigObject clone()
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public java.util.Set entrySet()
public java.util.Map flatten()
public java.util.Map flatten(java.util.Map target)
public java.lang.Object get(java.lang.Object key)
public java.net.URL getConfigFile()
public java.lang.Object getProperty(java.lang.String name)
public boolean isEmpty()
public java.util.Set keySet()
public java.util.Map merge(ConfigObject other)
other
- The ConfigObject to merge with
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
public void putAll(java.util.Map m)
public java.lang.Object remove(java.lang.Object key)
public void setConfigFile(java.net.URL configFile)
public int size()
public java.util.Properties toProperties()
public java.util.Properties toProperties(java.lang.String prefix)
prefix
- The prefix to append before property entries
public java.util.Collection values()
public java.io.Writer writeTo(java.io.Writer outArg)
Groovy Documentation