[Java] Class JsonDelegate

  • groovy.json.JsonDelegate

Utility class used as delegate of closures representing JSON objects.

Authors:
Guillaume Laforge
Andrey Bloschetsov
Since:
1.8.0

Methods Summary

Methods
Type Params Return Type Name and description
static Map<String, Object> cloneDelegateAndGetContent(Closure<?> c)
Factory method for creating JsonDelegates from closures.
static Map<String, Object> curryDelegateAndGetContent(Closure<?> c, Object o)
Factory method for creating JsonDelegates from closures currying an object argument.
Map<String, Object> getContent()
Object invokeMethod(String name, Object args)
Intercepts calls for setting a key and value for a JSON object

Inherited Methods Summary

Inherited Methods
Methods inherited from class Name
class GroovyObjectSupport getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty
class Object wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Method Detail

public static Map<String, Object> cloneDelegateAndGetContent(Closure<?> c)

Factory method for creating JsonDelegates from closures.

Parameters:
c - closure representing JSON objects
Returns:
an instance of JsonDelegate

public static Map<String, Object> curryDelegateAndGetContent(Closure<?> c, Object o)

Factory method for creating JsonDelegates from closures currying an object argument.

Parameters:
c - closure representing JSON objects
o - an object curried to the closure
Returns:
an instance of JsonDelegate

public Map<String, Object> getContent()

public Object invokeMethod(String name, Object args)

Intercepts calls for setting a key and value for a JSON object

Parameters:
name - the key name
args - the value associated with the key

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.4.21/html/gapi/groovy/json/JsonDelegate.html