public class ConfigObject extends GroovyObjectSupport implements Writable, java.util.Map, java.lang.Cloneable
Constructor and Description |
---|
ConfigObject() |
ConfigObject(java.net.URL file) |
Modifier and Type | Method and Description |
---|---|
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
|
getMetaClass, invokeMethod, setMetaClass, setProperty
public ConfigObject(java.net.URL file)
public ConfigObject()
public java.net.URL getConfigFile()
public void setConfigFile(java.net.URL configFile)
public java.io.Writer writeTo(java.io.Writer outArg) throws java.io.IOException
writeTo
in interface Writable
outArg
- the Writer to which this Writable should output its data.java.io.IOException
- if an error occurred while outputting data to the writerWritable.writeTo(java.io.Writer)
public java.lang.Object getProperty(java.lang.String name)
getProperty
in interface GroovyObject
getProperty
in class GroovyObjectSupport
name
- the name of the property of interestpublic java.util.Map flatten()
public java.util.Map flatten(java.util.Map target)
flatten()
public java.util.Map merge(ConfigObject other)
other
- The ConfigObject to merge withpublic java.util.Properties toProperties()
public java.util.Properties toProperties(java.lang.String prefix)
prefix
- The prefix to append before property entriespublic int size()
size
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
public void putAll(java.util.Map m)
putAll
in interface java.util.Map
public void clear()
clear
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public ConfigObject clone()
clone
in class java.lang.Object