You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2015/12/06 22:11:30 UTC
[2/3] groovy git commit: Binary compatibility improvements
Binary compatibility improvements
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/f98e6202
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/f98e6202
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/f98e6202
Branch: refs/heads/master
Commit: f98e6202999d022eb61f97318a3635b69881f928
Parents: 7e7fcf7
Author: graemerocher <gr...@gmail.com>
Authored: Wed Dec 2 11:49:02 2015 +0100
Committer: John Wagenleitner <jw...@apache.org>
Committed: Sun Dec 6 13:05:31 2015 -0800
----------------------------------------------------------------------
.../java/groovy/json/StreamingJsonBuilder.java | 25 ++++++++++++++++++++
1 file changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/f98e6202/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java b/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
index 11d6129..30cacb1 100644
--- a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
+++ b/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
@@ -210,6 +210,13 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
}
/**
+ * Delegates to {@link #call(Iterable, Closure)}
+ */
+ public Object call(Collection coll, @DelegatesTo(StreamingJsonDelegate.class) Closure c) throws IOException {
+ return call((Iterable)coll, c);
+ }
+
+ /**
* A closure passed to a JSON builder will create a root JSON object
* <p>
* Example:
@@ -294,6 +301,13 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
}
/**
+ * Delegates to {@link #call(String, Iterable, Closure)}
+ */
+ public void call(String name, Collection coll, @DelegatesTo(StreamingJsonDelegate.class) Closure c) throws IOException {
+ call(name, (Iterable)coll, c);
+ }
+
+ /**
* If you use named arguments and a closure as last argument,
* the key/value pairs of the map (as named arguments)
* and the key/value pairs represented in the closure
@@ -571,6 +585,13 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
}
/**
+ * Delegates to {@link #call(String, Iterable, Closure)}
+ */
+ public void call(String name, Collection coll, Closure c) throws IOException {
+ call(name, (Iterable)coll, c);
+ }
+
+ /**
* Writes the name and value of a JSON attribute
*
* @param name The attribute name
@@ -667,6 +688,10 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
return args.length == 2 && args[0] instanceof Iterable && args[1] instanceof Closure;
}
+ public static Object writeCollectionWithClosure(Writer writer, Collection coll, Closure closure) throws IOException {
+ return writeCollectionWithClosure(writer, (Iterable)coll, closure);
+ }
+
public static Object writeCollectionWithClosure(Writer writer, Iterable coll, Closure closure) throws IOException {
writer.write(JsonOutput.OPEN_BRACKET);
boolean first = true;