Package groovy.json

# Class JsonDelegate

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.json.JsonDelegate

All Implemented Interfaces:
  `GroovyObject`

public class JsonDelegate extends GroovyObjectSupport
Utility class used as delegate of closures representing JSON objects.

Since:
  1.8.0
Author:
  Guillaume Laforge, Andrey Bloschetsov

## Constructor Summary

Constructors
Constructor
Description
`JsonDelegate()`

## Method Summary

Modifier and Type
Method
Description
`static Map<String,Object>`
`cloneDelegateAndGetContent(Closure<?> c)`
Factory method for creating `JsonDelegate`s from closures.
`static Map<String,Object>`
`curryDelegateAndGetContent(Closure<?> c, Object o)`
Factory method for creating `JsonDelegate`s 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

### Methods inherited from class groovy.lang.GroovyObjectSupport

`getMetaClass, getProperty, setMetaClass, setProperty`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### JsonDelegate

public JsonDelegate()

## Method Details

### invokeMethod

public Object invokeMethod(String name, Object args)
Intercepts calls for setting a key and value for a JSON object

Specified by:
  `invokeMethod` in interface `GroovyObject`
Overrides:
  `invokeMethod` in class `GroovyObjectSupport`
Parameters:
  `name` - the key name
  `args` - the value associated with the key
Returns:
  the result of invoking the method

### cloneDelegateAndGetContent

public static Map<String,Object> cloneDelegateAndGetContent(Closure<?> c)
Factory method for creating `JsonDelegate`s from closures.

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

### curryDelegateAndGetContent

public static Map<String,Object> curryDelegateAndGetContent(Closure<?> c, Object o)
Factory method for creating `JsonDelegate`s from closures currying an object argument.

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

### getContent

public Map<String,Object> getContent()