StreamingJsonBuilder.StreamingJsonDelegate (Grails 3.1.1)
Date: 2016-02-04

Package: org.grails.web.json

## [Java] Class StreamingJsonDelegate

- org.grails.web.json.StreamingJsonBuilder.StreamingJsonDelegate

- The delegate used when invoking closures

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected boolean` | `first` |
    `protected StreamingJsonBuilder.StreamingJsonDelegate.State` | `state` |
    `protected java.io.Writer` | `writer` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `StreamingJsonBuilder.StreamingJsonDelegate (java.io.Writer w, boolean first)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `call(java.lang.String name, java.util.List<java.lang.Object> list)` Writes the name and a JSON array
    `void` | `call(java.lang.String name, java.lang.Object... array)` Writes the name and a JSON array
    `void` | `call(java.lang.String name, java.lang.Iterable coll, groovy.lang.Closure c)` A collection and closure passed to a JSON builder will create a root JSON array applying the closure to each object in the collection
    `void` | `call(java.lang.String name, java.util.Collection coll, groovy.lang.Closure c)` Delegates to call(String, Iterable, Closure)
    `void` | `call(java.lang.String name, java.lang.Object value)` Writes the name and value of a JSON attribute
    `void` | `call(java.lang.String name, java.lang.Object value, groovy.lang.Closure callable)` Writes the name and value of a JSON attribute
    `void` | `call(java.lang.String name, groovy.lang.Closure value)` Writes the name and another JSON object
    `void` | `call(java.lang.String name, groovy.json.JsonOutput$JsonUnescaped json)` Writes an unescaped value.
    `static void` | `cloneDelegateAndGetContent(java.io.Writer w, groovy.lang.Closure c)`
    `static void` | `cloneDelegateAndGetContent(java.io.Writer w, groovy.lang.Closure c, boolean first)`
    `static void` | `curryDelegateAndGetContent(java.io.Writer w, groovy.lang.Closure c, java.lang.Object o)`
    `static void` | `curryDelegateAndGetContent(java.io.Writer w, groovy.lang.Closure c, java.lang.Object o, boolean first)`
    `java.io.Writer` | `getWriter()` @return Obtains the current writer
    `java.lang.Object` | `invokeMethod(java.lang.String name, java.lang.Object args)`
    `static boolean` | `isCollectionWithClosure(java.lang.Object[] args)`
    `protected void` | `verifyValue()`
    `protected void` | `writeArray(java.util.List<java.lang.Object> list)`
    `static java.lang.Object` | `writeCollectionWithClosure(java.io.Writer writer, java.util.Collection coll, groovy.lang.Closure closure)`
    `static java.lang.Object` | `writeCollectionWithClosure(java.io.Writer writer, java.lang.Iterable coll, groovy.lang.Closure closure)`
    `protected void` | `writeName(java.lang.String name)`
    `protected void` | `writeValue(java.lang.Object value)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class groovy.lang.GroovyObjectSupport` | `groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll()`
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### protected boolean first

    - #### protected StreamingJsonBuilder.StreamingJsonDelegate.State state

    - #### protected final java.io.Writer writer

  - ### Constructor Detail

    - #### public StreamingJsonBuilder.StreamingJsonDelegate(java.io.Writer w, boolean first)

  - ### Method Detail

    - #### public void call(java.lang.String name, java.util.List<java.lang.Object> list)

      Writes the name and a JSON array

      throws:
        IOException
      Parameters:
        `name` - The name of the JSON attribute
        `list` - The list representing the array

    - #### public void call(java.lang.String name, java.lang.Object... array)

      Writes the name and a JSON array

      throws:
        IOException
      Parameters:
        `name` - The name of the JSON attribute
        `array` - The list representing the array

    - #### public void call(java.lang.String name, java.lang.Iterable coll, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure c)

      A collection and closure passed to a JSON builder will create a root JSON array applying the closure to each object in the collection

      Example:

           class Author {
                String name
           }
           def authorList = [new Author (name: "Guillaume"), new Author (name: "Jochen"), new Author (name: "Paul")]

           new StringWriter().with { w ->
               def json = new groovy.json.StreamingJsonBuilder(w)
               json.book {
                  authors authorList, { Author author ->
                   name author.name
                 }
               }

               assert w.toString() == '{"book":{"authors":[{"name":"Guillaume"},{"name":"Jochen"},{"name":"Paul"}]}}'
           }

      Parameters:
        `coll` - a collection
        `c` - a closure used to convert the objects of coll

    - #### public void call(java.lang.String name, java.util.Collection coll, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure c)

      Delegates to call(String, Iterable, Closure)

    - #### public void call(java.lang.String name, java.lang.Object value)

      Writes the name and value of a JSON attribute

      throws:
        IOException
      Parameters:
        `name` - The attribute name
        `value` - The value

    - #### public void call(java.lang.String name, java.lang.Object value, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure callable)

      Writes the name and value of a JSON attribute

      throws:
        IOException
      Parameters:
        `name` - The attribute name
        `value` - The value

    - #### public void call(java.lang.String name, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure value)

      Writes the name and another JSON object

      throws:
        IOException
      Parameters:
        `name` - The attribute name
        `value` - The value

    - #### public void call(java.lang.String name, groovy.json.JsonOutput$JsonUnescaped json)

      Writes an unescaped value. Note: can cause invalid JSON if passed JSON is invalid

      throws:
        IOException
      Parameters:
        `name` - The attribute name
        `json` - The value

    - #### public static void cloneDelegateAndGetContent(java.io.Writer w, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure c)

    - #### public static void cloneDelegateAndGetContent(java.io.Writer w, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure c, boolean first)

    - #### public static void curryDelegateAndGetContent(java.io.Writer w, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure c, java.lang.Object o)

    - #### public static void curryDelegateAndGetContent(java.io.Writer w, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure c, java.lang.Object o, boolean first)

    - #### public java.io.Writer getWriter()

      Returns:
        Obtains the current writer

    - #### public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)

    - #### public static boolean isCollectionWithClosure(java.lang.Object[] args)

    - #### protected void verifyValue()

    - #### protected void writeArray(java.util.List<java.lang.Object> list)

    - #### public static java.lang.Object writeCollectionWithClosure(java.io.Writer writer, java.util.Collection coll, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure closure)

    - #### public static java.lang.Object writeCollectionWithClosure(java.io.Writer writer, java.lang.Iterable coll, @groovy.lang.DelegatesTo(StreamingJsonDelegate.class) groovy.lang.Closure closure)

    - #### protected void writeName(java.lang.String name)

    - #### protected void writeValue(java.lang.Object value)