Package groovy.json
Class JsonDelegate
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.json.JsonDelegate
- All Implemented Interfaces:
groovy.lang.GroovyObject
public class JsonDelegate
extends groovy.lang.GroovyObjectSupport
Utility class used as delegate of closures representing JSON objects.
- Since:
- 1.8.0
-
Constructor Summary
Constructors Constructor Description JsonDelegate() -
Method Summary
Modifier and Type Method Description static Map<String,Object>cloneDelegateAndGetContent(groovy.lang.Closure<?> c)Factory method for creatingJsonDelegates from closures.static Map<String,Object>curryDelegateAndGetContent(groovy.lang.Closure<?> c, Object o)Factory method for creatingJsonDelegates from closures currying an object argument.Map<String,Object>getContent()ObjectinvokeMethod(String name, Object args)Intercepts calls for setting a key and value for a JSON objectMethods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClassMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
getProperty, setProperty
-
Constructor Details
-
JsonDelegate
public JsonDelegate()
-
-
Method Details
-
invokeMethod
Intercepts calls for setting a key and value for a JSON object- Parameters:
name- the key nameargs- the value associated with the key
-
cloneDelegateAndGetContent
Factory method for creatingJsonDelegates from closures.- Parameters:
c- closure representing JSON objects- Returns:
- an instance of
JsonDelegate
-
curryDelegateAndGetContent
Factory method for creatingJsonDelegates from closures currying an object argument.- Parameters:
c- closure representing JSON objectso- an object curried to the closure- Returns:
- an instance of
JsonDelegate
-
getContent
-