Package groovy.json
Class JsonDelegate
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.json.JsonDelegate
- All Implemented Interfaces:
GroovyObject
Utility class used as delegate of closures representing JSON objects.
- Since:
- 1.8.0
- Author:
- Guillaume Laforge, Andrey Bloschetsov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionFactory method for creatingJsonDelegate
s from closures.curryDelegateAndGetContent
(Closure<?> c, Object o) Factory method for creatingJsonDelegate
s from closures currying an object argument.invokeMethod
(String name, Object args) Intercepts calls for setting a key and value for a JSON objectMethods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
-
Constructor Details
-
JsonDelegate
public JsonDelegate()
-
-
Method Details
-
invokeMethod
Intercepts calls for setting a key and value for a JSON object- Specified by:
invokeMethod
in interfaceGroovyObject
- Overrides:
invokeMethod
in classGroovyObjectSupport
- Parameters:
name
- the key nameargs
- the value associated with the key- Returns:
- the result of invoking the method
-
cloneDelegateAndGetContent
Factory method for creatingJsonDelegate
s from closures.- Parameters:
c
- closure representing JSON objects- Returns:
- an instance of
JsonDelegate
-
curryDelegateAndGetContent
Factory method for creatingJsonDelegate
s from closures currying an object argument.- Parameters:
c
- closure representing JSON objectso
- an object curried to the closure- Returns:
- an instance of
JsonDelegate
-
getContent
-