Package groovy.json

Class 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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.Object> cloneDelegateAndGetContent​(groovy.lang.Closure<?> c)
      Factory method for creating JsonDelegates from closures.
      static java.util.Map<java.lang.String,​java.lang.Object> curryDelegateAndGetContent​(groovy.lang.Closure<?> c, java.lang.Object o)
      Factory method for creating JsonDelegates from closures currying an object argument.
      java.util.Map<java.lang.String,​java.lang.Object> getContent()  
      java.lang.Object invokeMethod​(java.lang.String name, java.lang.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 Detail

      • JsonDelegate

        public JsonDelegate()
    • Method Detail

      • invokeMethod

        public java.lang.Object invokeMethod​(java.lang.String name,
                                             java.lang.Object args)
        Intercepts calls for setting a key and value for a JSON object
        Specified by:
        invokeMethod in interface groovy.lang.GroovyObject
        Overrides:
        invokeMethod in class groovy.lang.GroovyObjectSupport
        Parameters:
        name - the key name
        args - the value associated with the key
      • cloneDelegateAndGetContent

        public static java.util.Map<java.lang.String,​java.lang.Object> cloneDelegateAndGetContent​(groovy.lang.Closure<?> c)
        Factory method for creating JsonDelegates from closures.
        Parameters:
        c - closure representing JSON objects
        Returns:
        an instance of JsonDelegate
      • curryDelegateAndGetContent

        public static java.util.Map<java.lang.String,​java.lang.Object> curryDelegateAndGetContent​(groovy.lang.Closure<?> c,
                                                                                                        java.lang.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
      • getContent

        public java.util.Map<java.lang.String,​java.lang.Object> getContent()