Repository: incubator-juneau Updated Branches: refs/heads/master 87d8211b6 -> 2ca845c0f
Fix whitespace. Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/2ca845c0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/2ca845c0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/2ca845c0 Branch: refs/heads/master Commit: 2ca845c0f22c76bb57920e7614385a5bcf2b9d63 Parents: 87d8211 Author: JamesBognar <[email protected]> Authored: Fri Apr 7 14:16:39 2017 -0400 Committer: JamesBognar <[email protected]> Committed: Fri Apr 7 14:16:39 2017 -0400 ---------------------------------------------------------------------- .../core/json/JsonConfigurationExample.java | 22 ++++++-------- .../examples/core/json/JsonSimpleExample.java | 32 ++++++++++---------- .../apache/juneau/examples/core/pojo/Pojo.java | 26 ++++++++-------- .../juneau/examples/core/rdf/RdfExample.java | 14 ++++----- 4 files changed, 46 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/2ca845c0/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java index 77febad..752597a 100644 --- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java +++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java @@ -24,17 +24,15 @@ import org.apache.juneau.json.JsonSerializer; import org.apache.juneau.json.JsonSerializerContext; public class JsonConfigurationExample { - public static void main(String[] args) throws Exception { - Pojo aPojo = new Pojo("a","</pojo>"); - // Json Serializers can be configured using properties defined in JsonSerializerContext - String withWhitespace = new JsonSerializerBuilder().ws().build().serialize(aPojo); - // the output will be padded with spaces after format characters - System.out.println(withWhitespace); + public static void main(String[] args) throws Exception { + Pojo aPojo = new Pojo("a","</pojo>"); + // Json Serializers can be configured using properties defined in JsonSerializerContext + String withWhitespace = new JsonSerializerBuilder().ws().build().serialize(aPojo); + // the output will be padded with spaces after format characters + System.out.println(withWhitespace); - String escaped = new JsonSerializerBuilder().escapeSolidus(true).build().serialize(aPojo); - // the output will have escaped / - System.out.println(escaped); - - - } + String escaped = new JsonSerializerBuilder().escapeSolidus(true).build().serialize(aPojo); + // the output will have escaped / + System.out.println(escaped); + } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/2ca845c0/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java index 31df733..eb72b6a 100644 --- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java +++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java @@ -24,26 +24,26 @@ import org.apache.juneau.json.JsonParser; import org.apache.juneau.json.JsonSerializer; public class JsonSimpleExample { - public static void main(String[] args) throws Exception{ - // Juneau provides static constants with the most commonly used configurations - // Get a reference to a serializer - converting POJO to flat format - JsonSerializer jsonSerializer = JsonSerializer.DEFAULT; - // Get a reference to a parser - converts that flat format back into the POJO - JsonParser jsonParser = JsonParser.DEFAULT; + public static void main(String[] args) throws Exception{ + // Juneau provides static constants with the most commonly used configurations + // Get a reference to a serializer - converting POJO to flat format + JsonSerializer jsonSerializer = JsonSerializer.DEFAULT; + // Get a reference to a parser - converts that flat format back into the POJO + JsonParser jsonParser = JsonParser.DEFAULT; - Pojo pojo = new Pojo("id","name"); + Pojo pojo = new Pojo("id","name"); - String flat = jsonSerializer.serialize(pojo); + String flat = jsonSerializer.serialize(pojo); - // Print out the created POJO in JSON format. - System.out.println(flat); + // Print out the created POJO in JSON format. + System.out.println(flat); - Pojo parse = jsonParser.parse(flat, Pojo.class); + Pojo parse = jsonParser.parse(flat, Pojo.class); - assert parse.getId().equals(pojo.getId()); - assert parse.getName().equals(pojo.getName()); + assert parse.getId().equals(pojo.getId()); + assert parse.getName().equals(pojo.getName()); - // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo - // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them. - } + // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo + // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them. + } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/2ca845c0/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java index c400899..857df99 100644 --- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java +++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java @@ -22,20 +22,20 @@ package org.apache.juneau.examples.core.pojo; import org.apache.juneau.annotation.BeanConstructor; public class Pojo { - private final String id; - private final String name; + private final String id; + private final String name; - @BeanConstructor(properties = "id,name") - public Pojo(String id, String name) { - this.id = id; - this.name = name; - } + @BeanConstructor(properties = "id,name") + public Pojo(String id, String name) { + this.id = id; + this.name = name; + } - public String getId() { - return id; - } + public String getId() { + return id; + } - public String getName() { - return name; - } + public String getName() { + return name; + } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/2ca845c0/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java ---------------------------------------------------------------------- diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java index 5b21ecf..3fb379e 100644 --- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java +++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java @@ -23,11 +23,11 @@ import org.apache.juneau.examples.core.pojo.Pojo; import org.apache.juneau.jena.RdfSerializer; public class RdfExample { - public static void main(String[] args) throws Exception { - Pojo pojo = new Pojo("rdf","This is RDF format."); - // this creates an RDF serializer with the default XML structure - RdfSerializer rdfSerializer = RdfSerializer.DEFAULT_XML; - // This will show the final output from the bean - System.out.println(rdfSerializer.serialize(pojo)); - } + public static void main(String[] args) throws Exception { + Pojo pojo = new Pojo("rdf","This is RDF format."); + // this creates an RDF serializer with the default XML structure + RdfSerializer rdfSerializer = RdfSerializer.DEFAULT_XML; + // This will show the final output from the bean + System.out.println(rdfSerializer.serialize(pojo)); + } }
