Repository: groovy Updated Branches: refs/heads/master b050b8be7 -> 9d06f1f13
grooy-json extend testing of javadoc examples Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/9d06f1f1 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9d06f1f1 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9d06f1f1 Branch: refs/heads/master Commit: 9d06f1f13bf1e10a2e5fb48659e83c48f5608e49 Parents: b050b8b Author: pascalschumacher <pascalschumac...@gmx.net> Authored: Thu Mar 3 23:07:44 2016 +0100 Committer: pascalschumacher <pascalschumac...@gmx.net> Committed: Thu Mar 3 23:07:44 2016 +0100 ---------------------------------------------------------------------- .../src/main/java/groovy/json/JsonBuilder.java | 46 ++++++++++---------- .../src/main/java/groovy/json/JsonSlurper.java | 4 +- .../java/groovy/json/JsonSlurperClassic.java | 4 +- 3 files changed, 27 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/9d06f1f1/subprojects/groovy-json/src/main/java/groovy/json/JsonBuilder.java ---------------------------------------------------------------------- diff --git a/subprojects/groovy-json/src/main/java/groovy/json/JsonBuilder.java b/subprojects/groovy-json/src/main/java/groovy/json/JsonBuilder.java index c4f6bbd..6a7804f 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/JsonBuilder.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/JsonBuilder.java @@ -35,7 +35,7 @@ import java.util.*; * to be able to learn about the various possibilities of usage. * <p> * Example: - * <pre><code> + * <pre><code class="groovyTestCase"> * def builder = new groovy.json.JsonBuilder() * def root = builder.people { * person { @@ -90,8 +90,8 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * Named arguments can be passed to the JSON builder instance to create a root JSON object * <p> * Example: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * json name: "Guillaume", age: 33 * * assert json.toString() == '{"name":"Guillaume","age":33}' @@ -110,8 +110,8 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * A list of elements as arguments to the JSON builder creates a root JSON array * <p> * Example: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * def result = json([1, 2, 3]) * * assert result instanceof List @@ -131,8 +131,8 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * Varargs elements as arguments to the JSON builder create a root JSON array * <p> * Example: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * def result = json 1, 2, 3 * * assert result instanceof List @@ -157,13 +157,13 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * the closure to each object in the collection * <p> * Example: - * <pre><code> + * <pre><code class="groovyTestCase"> * class Author { * String name * } * def authors = [new Author (name: "Guillaume"), new Author (name: "Jochen"), new Author (name: "Paul")] * - * def json = new JsonBuilder() + * def json = new groovy.json.JsonBuilder() * json authors, { Author author -> * name author.name * } @@ -197,8 +197,8 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * A closure passed to a JSON builder will create a root JSON object * <p> * Example: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * def result = json { * name "Guillaume" * age 33 @@ -229,8 +229,8 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * </ul> * <p> * Example with a classicala builder-style: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * def result = json.person { * name "Guillaume" * age 33 @@ -241,8 +241,8 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * </code></pre> * * Or alternatively with a method call taking named arguments: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * json.person name: "Guillaume", age: 33 * * assert json.toString() == '{"person":{"name":"Guillaume","age":33}}' @@ -254,16 +254,16 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * will be merged together — * the closure properties overriding the map key/values * in case the same key is used. - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * json.person(name: "Guillaume", age: 33) { town "Paris" } * * assert json.toString() == '{"person":{"name":"Guillaume","age":33,"town":"Paris"}}' * </code></pre> * * The empty args call will create a key whose value will be an empty JSON object: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * json.person() * * assert json.toString() == '{"person":{}}' @@ -334,8 +334,8 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * Serializes the internal data structure built with the builder to a conformant JSON payload string * <p> * Example: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * json { temperature 37 } * * assert json.toString() == '{"temperature":37}' @@ -366,8 +366,8 @@ public class JsonBuilder extends GroovyObjectSupport implements Writable { * so that you can have the builder serialize itself the JSON payload to a writer. * <p> * Example: - * <pre><code> - * def json = new JsonBuilder() + * <pre><code class="groovyTestCase"> + * def json = new groovy.json.JsonBuilder() * json { temperature 37 } * * def out = new StringWriter() http://git-wip-us.apache.org/repos/asf/groovy/blob/9d06f1f1/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurper.java ---------------------------------------------------------------------- diff --git a/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurper.java b/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurper.java index 156c339..959d3b4 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurper.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurper.java @@ -40,8 +40,8 @@ import java.util.*; * JSON slurper parses text or reader content into a data structure of lists and maps. * <p> * Example usage: - * <code><pre> - * def slurper = new JsonSlurper() + * <code><pre class="groovyTestCase"> + * def slurper = new groovy.json.JsonSlurper() * def result = slurper.parseText('{"person":{"name":"Guillaume","age":33,"pets":["dog","cat"]}}') * * assert result.person.name == "Guillaume" http://git-wip-us.apache.org/repos/asf/groovy/blob/9d06f1f1/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurperClassic.java ---------------------------------------------------------------------- diff --git a/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurperClassic.java b/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurperClassic.java index a851c9f..b2f5416 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurperClassic.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/JsonSlurperClassic.java @@ -47,8 +47,8 @@ import static groovy.json.JsonTokenType.STRING; * JSON slurper which parses text or reader content into a data structure of lists and maps. * <p> * Example usage: - * <code><pre> - * def slurper = new JsonSlurper() + * <code><pre class="groovyTestCase"> + * def slurper = new groovy.json.JsonSlurper() * def result = slurper.parseText('{"person":{"name":"Guillaume","age":33,"pets":["dog","cat"]}}') * * assert result.person.name == "Guillaume"