polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [48/52] [abbrv] polygene-java git commit: Fix value type lookup in serialization
Date Sun, 02 Apr 2017 17:48:30 GMT
Fix value type lookup in serialization

POLYGENE-105


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

Branch: refs/heads/develop
Commit: a34432da9e062f1c99c027ff5a5236edb1992a14
Parents: 7056ea4
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Sun Mar 26 17:02:06 2017 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Sun Apr 2 19:16:24 2017 +0200

----------------------------------------------------------------------
 .../apache/polygene/api/type/ValueCompositeType.java    |  6 ++++++
 .../serialization/javaxjson/JavaxJsonDeserializer.java  | 12 +++++++-----
 .../serialization/javaxxml/JavaxXmlDeserializer.java    | 10 +++++-----
 .../messagepack/MessagePackDeserializer.java            | 12 +++++++-----
 4 files changed, 25 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a34432da/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java b/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java
index 9190e68..bbeaf06 100644
--- a/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java
+++ b/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java
@@ -24,6 +24,7 @@ import java.util.Objects;
 import java.util.stream.Stream;
 import org.apache.polygene.api.association.AssociationDescriptor;
 import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
 import org.apache.polygene.api.util.Classes;
 import org.apache.polygene.api.value.ValueComposite;
 import org.apache.polygene.api.value.ValueDescriptor;
@@ -53,6 +54,11 @@ public final class ValueCompositeType extends ValueType
         this.model = model;
     }
 
+    public ModuleDescriptor module()
+    {
+        return model.module();
+    }
+
     public Stream<? extends PropertyDescriptor> properties()
     {
         return model.state().properties();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a34432da/core/spi/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonDeserializer.java
b/core/spi/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonDeserializer.java
index 4eb7a69..43765c9 100644
--- a/core/spi/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonDeserializer.java
+++ b/core/spi/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonDeserializer.java
@@ -152,7 +152,9 @@ public class JavaxJsonDeserializer extends AbstractTextDeserializer implements
J
                 ValueDescriptor valueDescriptor = module.valueDescriptor( typeInfo );
                 if( valueDescriptor != null )
                 {
-                    return (T) deserializeValueComposite( module, valueDescriptor.valueType(),
object );
+                    return (T) deserializeValueComposite( valueDescriptor.module(),
+                                                          valueDescriptor.valueType(),
+                                                          object );
                 }
             case STRING:
                 byte[] bytes = Base64.getDecoder().decode( asString( json ).getBytes( UTF_8
) );
@@ -218,10 +220,10 @@ public class JavaxJsonDeserializer extends AbstractTextDeserializer
implements J
         }
         ValueBuilder builder = module.instance().newValueBuilderWithState(
             valueType.primaryType(),
-            propertyFunction( module, json ),
-            associationFunction( module, json ),
-            manyAssociationFunction( module, json ),
-            namedAssociationFunction( module, json ) );
+            propertyFunction( valueType.module(), json ),
+            associationFunction( valueType.module(), json ),
+            manyAssociationFunction( valueType.module(), json ),
+            namedAssociationFunction( valueType.module(), json ) );
         return builder.newInstance();
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a34432da/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlDeserializer.java
----------------------------------------------------------------------
diff --git a/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlDeserializer.java
b/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlDeserializer.java
index 95da377..8c6bc7b 100644
--- a/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlDeserializer.java
+++ b/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlDeserializer.java
@@ -148,10 +148,10 @@ public class JavaxXmlDeserializer extends AbstractTextDeserializer implements
Xm
         }
         ValueBuilder builder = module.instance().newValueBuilderWithState(
             valueType.primaryType(),
-            propertyFunction( module, xml ),
-            associationFunction( module, xml ),
-            manyAssociationFunction( module, xml ),
-            namedAssociationFunction( module, xml ) );
+            propertyFunction( valueType.module(), xml ),
+            associationFunction( valueType.module(), xml ),
+            manyAssociationFunction( valueType.module(), xml ),
+            namedAssociationFunction( valueType.module(), xml ) );
         return builder.newInstance();
     }
 
@@ -307,7 +307,7 @@ public class JavaxXmlDeserializer extends AbstractTextDeserializer implements
Xm
             ValueDescriptor valueDescriptor = module.valueDescriptor( typeInfo.get() );
             if( valueDescriptor != null )
             {
-                return deserializeValueComposite( module, valueDescriptor.valueType(), xml
);
+                return deserializeValueComposite( valueDescriptor.module(), valueDescriptor.valueType(),
xml );
             }
         }
         if( xml.getNodeType() == Node.CDATA_SECTION_NODE )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a34432da/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java
----------------------------------------------------------------------
diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java
b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java
index 12cba93..402f9bc 100644
--- a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java
+++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java
@@ -210,10 +210,10 @@ public interface MessagePackDeserializer extends Deserializer
 
             ValueBuilder builder = module.instance().newValueBuilderWithState(
                 valueType.primaryType(),
-                propertyFunction( module, namedValues ),
-                associationFunction( module, namedValues ),
-                manyAssociationFunction( module, namedValues ),
-                namedAssociationFunction( module, namedValues ) );
+                propertyFunction( valueType.module(), namedValues ),
+                associationFunction( valueType.module(), namedValues ),
+                manyAssociationFunction( valueType.module(), namedValues ),
+                namedAssociationFunction( valueType.module(), namedValues ) );
             return builder.newInstance();
         }
 
@@ -301,7 +301,9 @@ public interface MessagePackDeserializer extends Deserializer
                         ValueDescriptor valueDescriptor = module.valueDescriptor( typeInfo.get()
);
                         if( valueDescriptor != null )
                         {
-                            return deserializeValueComposite( module, valueDescriptor.valueType(),
mapValue );
+                            return deserializeValueComposite( valueDescriptor.module(),
+                                                              valueDescriptor.valueType(),
+                                                              mapValue );
                         }
                     }
                 default:


Mime
View raw message