You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/08/19 12:18:58 UTC

[24/25] zest-java git commit: Saving the mess I am in before trying to restore 'develop' branch.

Saving the mess I am in before trying to restore 'develop' branch.


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/0e78cbcf
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/0e78cbcf
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/0e78cbcf

Branch: refs/heads/ValueSerializationCleaning
Commit: 0e78cbcf4de7a43e5508a886659c239f03b324c7
Parents: c62ee06
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Thu Jun 16 22:15:05 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Thu Jun 16 22:15:05 2016 +0800

----------------------------------------------------------------------
 .../apache/zest/api/value/ValueSerializer.java  | 185 ++-----------------
 .../spi/value/ValueDeserializerAdapter.java     |  11 +-
 .../zest/spi/value/ValueSerializerAdapter.java  |  33 +---
 ...AbstractValueCompositeSerializationTest.java |  54 +++++-
 .../elasticsearch/ElasticSearchIndexer.java     |   2 +-
 .../rdf/query/internal/RdfQueryParserImpl.java  |   4 +-
 .../jackson/JacksonValueDeserializer.java       |  51 ++---
 .../JacksonCollectionSerializationTest.java     |   9 +
 .../rdf/entity/EntityStateSerializer.java       |   2 +-
 .../serialization/JsonRepresentation.java       |   2 +-
 10 files changed, 88 insertions(+), 265 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java b/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java
index 249b78f..bd605c9 100644
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java
+++ b/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java
@@ -57,10 +57,14 @@ import org.apache.zest.api.composite.AmbiguousTypeException;
  *     <li>Double or double,</li>
  *     <li>BigInteger,</li>
  *     <li>BigDecimal,</li>
- *     <li>Date,</li>
- *     <li>DateTime (JodaTime),</li>
- *     <li>LocalDateTime (JodaTime),</li>
- *     <li>LocalDate (JodaTime).</li>
+ *     <li>ZonedDateTime</li>
+ *     <li>OffsetDateTime</li>
+ *     <li>LocalDateTime</li>
+ *     <li>LocalDate</li>
+ *     <li>LocalTime</li>
+ *     <li>Duration</li>
+ *     <li>Period</li>
+ *     <li>Instant</li>
  * </ul>
  * <p>
  *     Values of unknown types and all arrays are considered as {@link java.io.Serializable} and by so are serialized to
@@ -93,16 +97,6 @@ public interface ValueSerializer
     <T> Function<T, String> serialize( Options options );
 
     /**
-     * Factory method for a serialize function.
-     *
-     * @param <T> the parametrized function input type
-     * @param includeTypeInfo if type information should be included in the output
-     * @return a serialization function.
-     */
-    @Deprecated
-    <T> Function<T, String> serialize( boolean includeTypeInfo );
-
-    /**
      * Serialize the state of a value with type information.
      *
      * @param object an Object to serialize
@@ -124,18 +118,6 @@ public interface ValueSerializer
         throws ValueSerializationException;
 
     /**
-     * Serialize the state of a value.
-     *
-     * @param object an Object to serialize
-     * @param includeTypeInfo if type information should be included in the output
-     * @return the state
-     * @throws ValueSerializationException if the Value serialization failed
-     */
-    @Deprecated
-    String serialize( Object object, boolean includeTypeInfo )
-        throws ValueSerializationException;
-
-    /**
      * Serialize the state of a value with type information.
      *
      * @param object an Object to serialize
@@ -157,159 +139,14 @@ public interface ValueSerializer
         throws ValueSerializationException;
 
     /**
-     * Serialize the state of a value.
-     *
-     * @param object an Object to serialize
-     * @param output that will be used as output
-     * @param includeTypeInfo if type information should be included in the output
-     * @throws ValueSerializationException if the Value serialization failed
-     */
-    @Deprecated
-    void serialize( Object object, OutputStream output, boolean includeTypeInfo )
-        throws ValueSerializationException;
-
-    /**
      * Serialization options.
      */
     final class Options
     {
-        /**
-         * Boolean flag to include type information.
-         * Default to TRUE.
-         */
-        public static final String INCLUDE_TYPE_INFO = "includeTypeInfo";
-        private final Map<String, String> options = new HashMap<>();
-
-        /**
-         * Create new default ValueSerializer Options.
-         */
-        public Options()
-        {
-            this.options.put( INCLUDE_TYPE_INFO, "true" );
-        }
-
-        /**
-         * Set {@link #INCLUDE_TYPE_INFO} option to TRUE.
-         * @return This
-         */
-        public Options withTypeInfo()
-        {
-            return put( INCLUDE_TYPE_INFO, true );
-        }
-
-        /**
-         * Set {@link #INCLUDE_TYPE_INFO} option to FALSE.
-         * @return This
-         */
-        public Options withoutTypeInfo()
-        {
-            return put( INCLUDE_TYPE_INFO, false );
-        }
-
-        /**
-         * Get Boolean option value.
-         * @param option The option
-         * @return The boolean value of the option, or null if absent
-         */
-        public Boolean getBoolean( String option )
-        {
-            if( !options.containsKey( option ) )
-            {
-                return null;
-            }
-            return Boolean.valueOf( options.get( option ) );
-        }
-
-        /**
-         * Get Integer option value.
-         * @param option The option
-         * @return The integer value of the option, or null if absent
-         */
-        public Integer getInteger( String option )
-        {
-            if( !options.containsKey( option ) )
-            {
-                return null;
-            }
-            return Integer.valueOf( options.get( option ) );
-        }
-
-        /**
-         * Get String option value.
-         * @param option The option
-         * @return The string value of the option, or null if absent
-         */
-        public String getString( String option )
-        {
-            return options.get( option );
-        }
-
-        /**
-         * Put an option String value.
-         * @param option The option
-         * @param value The value
-         * @return This Options instance
-         */
-        public Options put( String option, String value )
-        {
-            if( value == null )
-            {
-                return remove( option );
-            }
-            options.put( option, value );
-            return this;
-        }
-
-        /**
-         * Put an option boolean value.
-         * @param option The option
-         * @param value The value
-         * @return This Options instance
-         */
-        public Options put( String option, Boolean value )
-        {
-            if( value == null )
-            {
-                return remove( option );
-            }
-            options.put( option, Boolean.toString( value ) );
-            return this;
-        }
-
-        /**
-         * Put an option Integer value.
-         * @param option The option
-         * @param value The value
-         * @return This Options instance
-         */
-        public Options put( String option, Integer value )
-        {
-            if( value == null )
-            {
-                return remove( option );
-            }
-            options.put( option, value.toString() );
-            return this;
-        }
-
-        /**
-         * Remove an option value.
-         * @param option The option
-         * @return This Options instance
-         */
-        public Options remove( String option )
-        {
-            options.remove( option );
-            return this;
-        }
+        public final boolean includeTypeInfo;
 
-        /**
-         * Get all defined options as a Map.
-         * @return All defined options in a new Map
-         */
-        public Map<String, String> toMap()
-        {
-            return new HashMap<>( options );
+        public Options( boolean includeTypeInfo ){
+            this.includeTypeInfo = includeTypeInfo;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/core/spi/src/main/java/org/apache/zest/spi/value/ValueDeserializerAdapter.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/value/ValueDeserializerAdapter.java b/core/spi/src/main/java/org/apache/zest/spi/value/ValueDeserializerAdapter.java
index e9c8c75..169f95e 100644
--- a/core/spi/src/main/java/org/apache/zest/spi/value/ValueDeserializerAdapter.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/value/ValueDeserializerAdapter.java
@@ -80,13 +80,10 @@ import static org.apache.zest.functional.Iterables.empty;
  * </p>
  * <ul>
  * <li>BigInteger and BigDecimal depends on {@link org.apache.zest.api.value.ValueSerializer.Options};</li>
- * <li>ZonedDateTime as a ISO-8601 String with optional timezone name;</li>
- * <li>OffsetDateTime as a ISO-8601 String with optional timezone offset;</li>
- * <li>LocalDateTime as whatever {@link LocalDateTime#parse} accept as {@literal instant};</li>
- * <li>LocalDate as whatever {@link LocalDate#parse} accept as {@literal instant};</li>
- * <li>LocalTime as whatever {@link LocalTime#parse} accept as {@literal instant};</li>
- * <li>Duration as a ISO-8601 String representing a {@link java.time.Duration}</li>
- * <li>Period as a ISO-8601 String representing a {@link java.time.Period}</li>
+ * <li>Date as String in ISO-8601, {@literal @millis@} or {@literal /Date(..)} Microsoft format;</li>
+ * <li>DateTime (JodaTime) as a ISO-8601 String with optional timezone offset;</li>
+ * <li>LocalDateTime (JodaTime) as whatever {@link LocalDateTime#parse} accept as {@literal instant};</li>
+ * <li>LocalDate (JodaTime) as whatever {@link LocalDate#parse} accept as {@literal instant};</li>
  * </ul>
  *
  * @param <InputType>     Implementor pull-parser type

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/core/spi/src/main/java/org/apache/zest/spi/value/ValueSerializerAdapter.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/value/ValueSerializerAdapter.java b/core/spi/src/main/java/org/apache/zest/spi/value/ValueSerializerAdapter.java
index 8a223e5..a643476 100644
--- a/core/spi/src/main/java/org/apache/zest/spi/value/ValueSerializerAdapter.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/value/ValueSerializerAdapter.java
@@ -172,19 +172,10 @@ public abstract class ValueSerializerAdapter<OutputType>
     }
 
     @Override
-    @Deprecated
-    public final <T> Function<T, String> serialize( final boolean includeTypeInfo )
-    {
-        return object -> serialize(
-            includeTypeInfo ? new Options().withTypeInfo() : new Options().withoutTypeInfo(),
-            object );
-    }
-
-    @Override
     public final String serialize( Object object )
         throws ValueSerializationException
     {
-        return serialize( new Options(), object );
+        return serialize( new Options(true), object );
     }
 
     @Override
@@ -208,19 +199,10 @@ public abstract class ValueSerializerAdapter<OutputType>
     }
 
     @Override
-    @Deprecated
-    public final String serialize( Object object, boolean includeTypeInfo )
-        throws ValueSerializationException
-    {
-        return serialize( includeTypeInfo ? new Options().withTypeInfo() : new Options().withoutTypeInfo(),
-                          object );
-    }
-
-    @Override
     public final void serialize( Object object, OutputStream output )
         throws ValueSerializationException
     {
-        serialize( new Options(), object, output );
+        serialize( new Options(true), object, output );
     }
 
     @Override
@@ -241,15 +223,6 @@ public abstract class ValueSerializerAdapter<OutputType>
         }
     }
 
-    @Override
-    @Deprecated
-    public final void serialize( Object object, OutputStream output, boolean includeTypeInfo )
-        throws ValueSerializationException
-    {
-        serialize( includeTypeInfo ? new Options().withTypeInfo() : new Options().withoutTypeInfo(),
-                   object, output );
-    }
-
     private void serializeRoot( Options options, Object object, OutputStream output )
         throws Exception
     {
@@ -345,7 +318,7 @@ public abstract class ValueSerializerAdapter<OutputType>
         onObjectStart( output );
 
         //noinspection ConstantConditions
-        if( options.getBoolean( Options.INCLUDE_TYPE_INFO ) && !rootPass )
+        if( options.includeTypeInfo && !rootPass )
         {
             onFieldStart( output, "_type" );
             onValueStart( output );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java
index ce9d361..08a47f5 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/value/AbstractValueCompositeSerializationTest.java
@@ -21,19 +21,18 @@ package org.apache.zest.test.value;
 
 import java.io.ByteArrayOutputStream;
 import java.io.Serializable;
+import java.time.Duration;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.OffsetDateTime;
+import java.time.Period;
 import java.time.ZoneOffset;
+import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.structure.Module;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.association.ManyAssociation;
 import org.apache.zest.api.association.NamedAssociation;
@@ -44,9 +43,11 @@ import org.apache.zest.api.entity.EntityBuilder;
 import org.apache.zest.api.entity.EntityComposite;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.injection.scope.Service;
+import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.property.Property;
+import org.apache.zest.api.structure.Module;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.value.ValueBuilder;
 import org.apache.zest.api.value.ValueComposite;
@@ -55,6 +56,9 @@ import org.apache.zest.bootstrap.AssemblyException;
 import org.apache.zest.bootstrap.ModuleAssembly;
 import org.apache.zest.test.AbstractZestTest;
 import org.apache.zest.test.EntityTestAssembler;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
@@ -79,7 +83,9 @@ public abstract class AbstractValueCompositeSerializationTest
         throws AssemblyException
     {
         module.values( SomeValue.class, AnotherValue.class, FooValue.class, CustomFooValue.class,
-                       SpecificCollection.class /*, SpecificValue.class, GenericValue.class */ );
+                       SpecificCollection.class, /* SpecificValue.class, GenericValue.class, */
+                       ComplexKey.class
+        );
 
         new EntityTestAssembler().visibleIn( Visibility.layer ).assemble( module.layer().module( "persistence" ) );
         module.entities( BarEntity.class );
@@ -89,10 +95,28 @@ public abstract class AbstractValueCompositeSerializationTest
     protected ValueSerialization valueSerialization;
 
     @Test
+    public void givenComplexKeyWhenDeserializingExpectSuccess()
+        throws Exception
+    {
+        Map<String, Map<Duration, Period>> map1 = new HashMap<>();
+        Map<Duration, Period> map2 = new HashMap<>();
+        map2.put( Duration.of( 1000, ChronoUnit.MILLIS ), Period.of( 1, 2, 3 ) );
+        map1.put( "habba", map2 );
+        ValueBuilder<ComplexKey> builder = valueBuilderFactory.newValueBuilder( ComplexKey.class );
+        builder.prototype().durations().set( map1 );
+        ComplexKey underTest = builder.newInstance();
+
+        String serialized = valueSerialization.serialize( underTest );
+        assertThat( serialized, equalTo( "{\"durations\":{\"habba\":{\"PT1S\":\"P1Y2M3D\"}}}" ) );
+        ComplexKey result = moduleInstance.newValueFromSerializedState( ComplexKey.class, serialized );
+        assertThat( result, equalTo( underTest ) );
+    }
+
+    @Test
     public void givenValueCompositeWhenSerializingAndDeserializingExpectEquals()
         throws Exception
     {
-        try(UnitOfWork uow = unitOfWorkFactory.newUnitOfWork())
+        try (UnitOfWork uow = unitOfWorkFactory.newUnitOfWork())
         {
             SomeValue some = buildSomeValue();
 
@@ -102,12 +126,15 @@ public abstract class AbstractValueCompositeSerializationTest
             String stateString = output.toString( "UTF-8" );
 
             // Deserialize using Module API
-            System.out.println(stateString);
+            System.out.println( stateString );
             SomeValue some2 = moduleInstance.newValueFromSerializedState( SomeValue.class, stateString );
 
             assertThat( "String Integer Map", some2.stringIntMap().get().get( "foo" ), equalTo( 42 ) );
             assertThat( "String Value Map", some2.stringValueMap().get().get( "foo" ).internalVal(), equalTo( "Bar" ) );
-            assertThat( "Nested Entities", some2.barAssociation().get().cathedral().get(), equalTo( "bazar in barAssociation" ) );
+            assertThat( "Nested Entities", some2.barAssociation()
+                .get()
+                .cathedral()
+                .get(), equalTo( "bazar in barAssociation" ) );
 
             assertThat( "Same value", some, equalTo( some2 ) );
             assertThat( "Same JSON value toString", stateString, equalTo( some2.toString() ) );
@@ -189,7 +216,8 @@ public abstract class AbstractValueCompositeSerializationTest
         proto.barNamedAssociation().put( "bazar", buildBarEntity( "bazar in barNamedAssociation" ) );
         proto.barNamedAssociation().put( "cathedral", buildBarEntity( "cathedral in barNamedAssociation" ) );
         proto.barEntityNamedAssociation().put( "bazar", buildBarEntity( "bazar in barEntityNamedAssociation" ) );
-        proto.barEntityNamedAssociation().put( "cathedral", buildBarEntity( "cathedral in barEntityNamedAssociation" ) );
+        proto.barEntityNamedAssociation()
+            .put( "cathedral", buildBarEntity( "cathedral in barEntityNamedAssociation" ) );
 
         return builder.newInstance();
     }
@@ -396,6 +424,12 @@ public abstract class AbstractValueCompositeSerializationTest
     {
     }
 
+    public interface ComplexKey
+    {
+        @UseDefaults
+        Property<Map<String, Map<Duration, Period>>> durations();
+    }
+
     public static class SerializableObject
         implements Serializable
     {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java
index f51d512..0c04214 100755
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java
@@ -219,7 +219,7 @@ public interface ElasticSearchIndexer
                         }
                         else
                         {
-                            String serialized = valueSerializer.serialize( new Options().withoutTypeInfo(), value );
+                            String serialized = valueSerializer.serialize( new Options(false), value );
                             // TODO Theses tests are pretty fragile, find a better way to fix this, Jackson API should behave better
                             if( serialized.startsWith( "{" ) )
                             {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java b/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java
index 0932df0..e79178f 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java
@@ -331,7 +331,7 @@ public class RdfQueryParserImpl
 
     private String createAndEscapeJSONString( Object value )
     {
-        return escapeJSONString( valueSerializer.serialize( new Options().withoutTypeInfo(), value ) );
+        return escapeJSONString( valueSerializer.serialize( new Options(false), value ) );
     }
 
     private String createRegexStringForContaining( String valueVariable, String containedString )
@@ -387,7 +387,7 @@ public class RdfQueryParserImpl
             String jsonStr = "";
             if( item != null )
             {
-                String serialized = valueSerializer.serialize( item, false );
+                String serialized = valueSerializer.serialize( new Options(false), item );
                 if( item instanceof String )
                 {
                     serialized = "\"" + StringEscapeUtils.escapeJava( serialized ) + "\"";

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/extensions/valueserialization-jackson/src/main/java/org/apache/zest/valueserialization/jackson/JacksonValueDeserializer.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/main/java/org/apache/zest/valueserialization/jackson/JacksonValueDeserializer.java b/extensions/valueserialization-jackson/src/main/java/org/apache/zest/valueserialization/jackson/JacksonValueDeserializer.java
index 2fb106f..e355f94 100644
--- a/extensions/valueserialization-jackson/src/main/java/org/apache/zest/valueserialization/jackson/JacksonValueDeserializer.java
+++ b/extensions/valueserialization-jackson/src/main/java/org/apache/zest/valueserialization/jackson/JacksonValueDeserializer.java
@@ -22,6 +22,7 @@ package org.apache.zest.valueserialization.jackson;
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.core.TreeNode;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.MappingJsonFactory;
 import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -135,58 +136,30 @@ public class JacksonValueDeserializer
     )
         throws Exception
     {
-        JsonToken token = input.getCurrentToken();
-        if( token == JsonToken.VALUE_NULL )
+        JsonToken currentToken = input.getCurrentToken();
+        if( currentToken == JsonToken.VALUE_NULL )
         {
             return null;
         }
-        if( token != JsonToken.START_ARRAY )
+        if( currentToken != JsonToken.START_OBJECT )
         {
-            token = input.nextToken();
+            currentToken = input.nextToken();
         }
-        if( token == JsonToken.VALUE_NULL )
+        if( currentToken == JsonToken.VALUE_NULL )
         {
             return null;
         }
-        if( token != JsonToken.START_ARRAY )
+        if( currentToken != JsonToken.START_OBJECT )
         {
             throw new ValueSerializationException( "Expected an array start at "
                                                    + input.getCurrentLocation().toString() );
         }
-        JsonToken currentToken = input.nextToken();
-        while( currentToken != JsonToken.END_ARRAY )
+        currentToken = input.nextToken(); // Take the object start
+        while( currentToken != JsonToken.END_OBJECT )
         {
-            if( currentToken != JsonToken.START_OBJECT )
-            {
-                throw new ValueSerializationException( "Expected an object start at "
-                                                       + input.getCurrentLocation().toString() );
-            }
-            currentToken = input.nextToken();
-            K key = null;
-            V value = null;
-            while( currentToken != JsonToken.END_OBJECT )
-            {
-                String objectKey = input.getCurrentName();
-                input.nextToken();
-                if( "key".equals( objectKey ) )
-                {
-                    key = keyDeserializer.apply( input );
-                }
-                else if( "value".equals( objectKey ) )
-                {
-                    value = valueDeserializer.apply( input );
-                }
-                else
-                {
-                    //input.nextToken();
-                    input.skipChildren();
-                }
-                currentToken = input.nextToken();
-            }
-            if( key != null )
-            {
-                map.put( key, value );
-            }
+            K key = keyDeserializer.apply( input );
+            V value = valueDeserializer.apply( input );
+            map.put( key, value );
             currentToken = input.nextToken();
         }
         return map;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/extensions/valueserialization-jackson/src/test/java/org/apache/zest/valueserialization/jackson/JacksonCollectionSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/zest/valueserialization/jackson/JacksonCollectionSerializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/zest/valueserialization/jackson/JacksonCollectionSerializationTest.java
index dffa616..98a09d8 100644
--- a/extensions/valueserialization-jackson/src/test/java/org/apache/zest/valueserialization/jackson/JacksonCollectionSerializationTest.java
+++ b/extensions/valueserialization-jackson/src/test/java/org/apache/zest/valueserialization/jackson/JacksonCollectionSerializationTest.java
@@ -19,6 +19,15 @@
  */
 package org.apache.zest.valueserialization.jackson;
 
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.core.TreeNode;
+import com.fasterxml.jackson.databind.MappingJsonFactory;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 import org.apache.zest.bootstrap.AssemblyException;
 import org.apache.zest.bootstrap.ModuleAssembly;
 import org.apache.zest.test.value.AbstractCollectionSerializationTest;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityStateSerializer.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityStateSerializer.java b/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityStateSerializer.java
index 1be4b52..1d6c3b2 100644
--- a/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityStateSerializer.java
+++ b/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityStateSerializer.java
@@ -152,7 +152,7 @@ public class EntityStateSerializer
         }
         else
         {
-            String stringProperty = valueSerializer.serialize( new Options().withoutTypeInfo(), property );
+            String stringProperty = valueSerializer.serialize( new Options(false), property );
             final Literal object = valueFactory.createLiteral( stringProperty );
             graph.add( subject, predicate, object );
         }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/0e78cbcf/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java
index 71eaa12..56fa850 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java
@@ -42,7 +42,7 @@ import org.restlet.representation.Representation;
 public class JsonRepresentation<T> extends OutputRepresentation
 {
 
-    private static final ValueSerializer.Options OPTIONS_NO_TYPE = new ValueSerializer.Options().withoutTypeInfo();
+    private static final ValueSerializer.Options OPTIONS_NO_TYPE = new ValueSerializer.Options(false);
 
     @Structure
     private ZestSPI spi;