diff --git a/genson/src/main/java/com/owlike/genson/Genson.java b/genson/src/main/java/com/owlike/genson/Genson.java index f118105c..e8a43ae8 100644 --- a/genson/src/main/java/com/owlike/genson/Genson.java +++ b/genson/src/main/java/com/owlike/genson/Genson.java @@ -399,18 +399,30 @@ public T deserialize(GenericType type, ObjectReader reader, Context ctx) } } + /** + * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) + */ public T deserializeInto(String json, T object) { return deserializeInto(createReader(new StringReader(json)), object, new Context(this)); } + /** + * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) + */ public T deserializeInto(byte[] jsonBytes, T object) { return deserializeInto(createReader(jsonBytes), object, new Context(this)); } + /** + * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) + */ public T deserializeInto(InputStream is, T object) { return deserializeInto(createReader(is), object, new Context(this)); } + /** + * @see #deserializeInto(com.owlike.genson.stream.ObjectReader, Object, Context) + */ public T deserializeInto(Reader reader, T object) { return deserializeInto(createReader(reader), object, new Context(this)); } diff --git a/genson/src/main/java/com/owlike/genson/GensonBuilder.java b/genson/src/main/java/com/owlike/genson/GensonBuilder.java index 2ba12ced..0a456711 100644 --- a/genson/src/main/java/com/owlike/genson/GensonBuilder.java +++ b/genson/src/main/java/com/owlike/genson/GensonBuilder.java @@ -619,7 +619,7 @@ public GensonBuilder failOnMissingProperty(boolean enable) { } /** - * If set to false, during serialization class metadata will not be serialized for types that are the same as the static type. + * If set to false, during serialization class metadata will be serialized only for types where the runtime type differs from the static one. * Ex: * *
diff --git a/website/Documentation/Changelog.md b/website/Documentation/Changelog.md
index 1fd25c1b..3b106e69 100644
--- a/website/Documentation/Changelog.md
+++ b/website/Documentation/Changelog.md
@@ -3,6 +3,19 @@ title: Changelog
 layout: default
 ---
 
+##Release 1.2 - 22 September 2014
+
+"Medium" release providing new extensions, configuration and bug fixes. The API remains backwards compatible.
+
+ * Adding support for json4s AST via the new bundle Json4SBundle
+ * Issue #4 Ads deserializeInto method in Genson, allowing to deserialize in an exisintg Pojo
+ * Issue #13 Ads failOnMissingProperty option allowing to throw an exception when no property
+ * Issue #17 Ads useClassMetadataWithStaticType option allowing to ser or not object type when it is the same the static type.
+ in the class matches with the on in the json.
+ * Fixes a bug in the ScalaBundle when serializing to a byte array
+ * Issue #19 Handling correctly root arrays in ScalaBundle
+
+
 ##Release 1.1 - 13 July 2014
 
 Minor release providing bug fixes:
diff --git a/website/Documentation/Configuration.md b/website/Documentation/Configuration.md
index e834a341..2f7f59f4 100644
--- a/website/Documentation/Configuration.md
+++ b/website/Documentation/Configuration.md
@@ -139,5 +139,17 @@ GensonBuilder provides several methods to register components such as Converters
   By default byte arrays are ser/de as base64 encoded strings.
    When this feature is enabled, each byte will be ser/de as its numeric value.
 
+
+  useClassMetadataWithStaticType
+  True
+  If set to false, during serialization class metadata will be serialized only for types where
+  the runtime type differs from the static one.
+
+
+  failOnMissingProperty
+  False
+  If set to true, Genson will throw a JsonBindingException when it encounters a property in the incoming json that does not match
+   a property in the class. By default it skips this value silently.
+
 
 
\ No newline at end of file
diff --git a/website/Documentation/Extensions.md b/website/Documentation/Extensions.md
index a2215c8c..f8542f02 100644
--- a/website/Documentation/Extensions.md
+++ b/website/Documentation/Extensions.md
@@ -45,6 +45,40 @@ The implementation will detect it and use Genson for json conversions.
 
 Actually it has been tested with Jersey and Resteasy. It works out of the box.
 
+
+**Note**
+
+* By default Genson JAX-RS integration enables JAXB annotations support.
+* Starting with Jersey 2.9, automatic discovery is disabled, at the moment you have two solutions to make it work:
+
+
+ 1) Enable it programmatically (preferred way).
+
+ On the server side:
+
+{% highlight java %}
+final ResourceConfig config = new ResourceConfig().register(GensonJsonConverter.class);
+{% endhighlight %}
+
+ On the client side:
+
+{% highlight java %}
+final ClientConfig clientConfig = new ClientConfig().register(GensonJsonConverter.class);
+{% endhighlight %}
+
+Adding a customized Genson instance can be achieved through the same registeration mechanism.
+
+ 2) In order to detect it automatically like in previous versions you can add a dependency to jersey-metainf-services
+ (I discourage this option as the jersey-metainf-services package seems to be there only for backwards compatibility).
+
+{% highlight xml %}
+
+  org.glassfish.jersey.ext
+  jersey-metainf-services
+  your_version
+
+{% endhighlight %}
+
 ###Customization###
 In many cases you might want to customize Genson instance.
 To do that use GensonBuilder to create a custom instance and then inject it with ContextResolver.
@@ -63,21 +97,6 @@ public class GensonCustomResolver implements ContextResolver {
 {% endhighlight %}
 
 
-**Note**
-
-* By default Genson JAX-RS integration enables JAXB annotations support.
-* Starting with Jersey 2.9, automatic discovery is disabled, in order to enable it like in previous versions you need
- to a dependency to jersey-metainf-services.
-
-{% highlight xml %}
-
-  org.glassfish.jersey.ext
-  jersey-metainf-services
-  your_version
-
-{% endhighlight %}
-
-
 ##JSR 353 - Java API for Json Processing##
 
 Genson provides two kind of integrations with the JSR. You can use it as the JSR implementation or
diff --git a/website/Documentation/ScalaGuide.md b/website/Documentation/ScalaGuide.md
index eeee7c40..e6a3aa7a 100644
--- a/website/Documentation/ScalaGuide.md
+++ b/website/Documentation/ScalaGuide.md
@@ -195,7 +195,7 @@ object CustomGenson {
 import CustomGenson.genson._
 
 // and use it!
-val json = fromJson[JValue]("""{"name":"foo","someDouble":28.1,"male":true,"someArray":[1,2,3],"null":null}""")
+val json = fromJson[JObject]("""{"name":"foo","someDouble":28.1,"male":true,"someArray":[1,2,3],"null":null}""")
 
 {% endhighlight %}
 
diff --git a/website/Documentation/UserGuide.md b/website/Documentation/UserGuide.md
index 31f00cd8..248543db 100644
--- a/website/Documentation/UserGuide.md
+++ b/website/Documentation/UserGuide.md
@@ -140,6 +140,13 @@ public class Address {
 
 **Remark** Actually inner and anonymous classes serialization is supported but not deserialization, except if it is a static inner class.
 
+You can also deserialize in an existing object. However this feature has some restrictions: it works only with Pojo like classes and does not handle nesting.
+For example if your root object contains a list or another Pojo, then it will be overriden by the one in the json (if present, otherwise it remains unchanged).
+
+{% highlight java %}
+genson.deserializeInto(json, personInstance);
+{% endhighlight %}
+
 
 ##Filter/Rename properties##