X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Fserialization%2FDefaultSerializerFactory.java;h=1f1ac98097c6585cec7696a3c21f5c4a09680f5d;hb=refs%2Fchanges%2F97%2F2597%2F1;hp=07b3ca85e63638552a28da83787041b8be187066;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git
diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/serialization/DefaultSerializerFactory.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/serialization/DefaultSerializerFactory.java
index 07b3ca85e..1f1ac9809 100644
--- a/bundles/org.simantics.databoard/src/org/simantics/databoard/serialization/DefaultSerializerFactory.java
+++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/serialization/DefaultSerializerFactory.java
@@ -1,213 +1,213 @@
-package org.simantics.databoard.serialization;
-
-import java.util.Map;
-
-import org.simantics.databoard.binding.ArrayBinding;
-import org.simantics.databoard.binding.Binding;
-import org.simantics.databoard.binding.BooleanBinding;
-import org.simantics.databoard.binding.ByteBinding;
-import org.simantics.databoard.binding.DoubleBinding;
-import org.simantics.databoard.binding.FloatBinding;
-import org.simantics.databoard.binding.IntegerBinding;
-import org.simantics.databoard.binding.LongBinding;
-import org.simantics.databoard.binding.MapBinding;
-import org.simantics.databoard.binding.OptionalBinding;
-import org.simantics.databoard.binding.RecordBinding;
-import org.simantics.databoard.binding.StringBinding;
-import org.simantics.databoard.binding.UnionBinding;
-import org.simantics.databoard.binding.VariantBinding;
-import org.simantics.databoard.binding.impl.BooleanArrayBinding;
-import org.simantics.databoard.binding.impl.ByteArrayBinding;
-import org.simantics.databoard.binding.impl.DoubleArrayBinding;
-import org.simantics.databoard.binding.impl.FloatArrayBinding;
-import org.simantics.databoard.binding.impl.IntArrayBinding;
-import org.simantics.databoard.binding.impl.LongArrayBinding;
-import org.simantics.databoard.serialization.impl.ArraySerializer;
-import org.simantics.databoard.serialization.impl.BooleanArraySerializer;
-import org.simantics.databoard.serialization.impl.BooleanSerializer;
-import org.simantics.databoard.serialization.impl.ByteArraySerializer;
-import org.simantics.databoard.serialization.impl.ByteSerializer;
-import org.simantics.databoard.serialization.impl.DoubleArraySerializer;
-import org.simantics.databoard.serialization.impl.DoubleSerializer;
-import org.simantics.databoard.serialization.impl.FloatArraySerializer;
-import org.simantics.databoard.serialization.impl.FloatSerializer;
-import org.simantics.databoard.serialization.impl.GenericRecordSerializer;
-import org.simantics.databoard.serialization.impl.IntArraySerializer;
-import org.simantics.databoard.serialization.impl.IntSerializer;
-import org.simantics.databoard.serialization.impl.LongArraySerializer;
-import org.simantics.databoard.serialization.impl.LongSerializer;
-import org.simantics.databoard.serialization.impl.MapSerializer;
-import org.simantics.databoard.serialization.impl.ModifiedUTF8StringSerializer;
-import org.simantics.databoard.serialization.impl.MutableVariantSerializer;
-import org.simantics.databoard.serialization.impl.OptionalSerializer;
-import org.simantics.databoard.serialization.impl.ReferableRecordSerializer;
-import org.simantics.databoard.serialization.impl.UnionSerializer;
-import org.simantics.databoard.serialization.impl.VariantSerializer;
-import org.simantics.databoard.type.ArrayType;
-import org.simantics.databoard.type.BooleanType;
-import org.simantics.databoard.type.ByteType;
-import org.simantics.databoard.type.DoubleType;
-import org.simantics.databoard.type.FloatType;
-import org.simantics.databoard.type.IntegerType;
-import org.simantics.databoard.type.LongType;
-
-/**
- * Default serializer factory creates serializers that follow databoard serialization
- * specification.
- *
- * Binary Serialization format
- *
- *
- * @author Toni Kalajainen
- */
-public class DefaultSerializerFactory extends SerializerFactory {
-
- /**
- * Construct a new serializer.
- */
- public DefaultSerializerFactory() {
- super();
- }
-
- /**
- * Construct a new serializer factory that places constructed serializers
- * into user given repository.
- *
- * @param repository
- */
- public DefaultSerializerFactory(Map repository) {
- super(repository);
- }
-
- @Override
- protected Serializer doConstruct(Binding binding)
- throws SerializerConstructionException {
-
- // Specialized serializers
- if(binding instanceof SpecializedSerializerProvider) {
- Serializer specializedSerializer =
- ((SpecializedSerializerProvider)binding).getSpecializedSerializer();
- if(specializedSerializer != null)
- return specializedSerializer;
- }
-
- // Primitives
- if (binding instanceof BooleanBinding) return new BooleanSerializer( (BooleanBinding) binding );
- if (binding instanceof ByteBinding) return new ByteSerializer( (ByteBinding) binding );
- if (binding instanceof IntegerBinding) return new IntSerializer( (IntegerBinding) binding );
- if (binding instanceof LongBinding) return new LongSerializer( (LongBinding) binding );
- if (binding instanceof FloatBinding) return new FloatSerializer( (FloatBinding) binding );
- if (binding instanceof DoubleBinding) return new DoubleSerializer( (DoubleBinding) binding );
- if (binding instanceof StringBinding) return new ModifiedUTF8StringSerializer( (StringBinding) binding );
-
- // Record
- if (binding instanceof RecordBinding) {
- RecordBinding b = (RecordBinding) binding;
- Binding[] componentBindings = b.getComponentBindings();
- int count = b.getComponentCount();
-
- if ( b.type().isReferable() ) {
- ReferableRecordSerializer result = new ReferableRecordSerializer(b, null);
- inprogress.put(binding, result);
- result.componentSerializers = new Serializer[count];
- for (int i=0; iBinary Serialization format
+ *
+ *
+ * @author Toni Kalajainen
+ */
+public class DefaultSerializerFactory extends SerializerFactory {
+
+ /**
+ * Construct a new serializer.
+ */
+ public DefaultSerializerFactory() {
+ super();
+ }
+
+ /**
+ * Construct a new serializer factory that places constructed serializers
+ * into user given repository.
+ *
+ * @param repository
+ */
+ public DefaultSerializerFactory(Map repository) {
+ super(repository);
+ }
+
+ @Override
+ protected Serializer doConstruct(Binding binding)
+ throws SerializerConstructionException {
+
+ // Specialized serializers
+ if(binding instanceof SpecializedSerializerProvider) {
+ Serializer specializedSerializer =
+ ((SpecializedSerializerProvider)binding).getSpecializedSerializer();
+ if(specializedSerializer != null)
+ return specializedSerializer;
+ }
+
+ // Primitives
+ if (binding instanceof BooleanBinding) return new BooleanSerializer( (BooleanBinding) binding );
+ if (binding instanceof ByteBinding) return new ByteSerializer( (ByteBinding) binding );
+ if (binding instanceof IntegerBinding) return new IntSerializer( (IntegerBinding) binding );
+ if (binding instanceof LongBinding) return new LongSerializer( (LongBinding) binding );
+ if (binding instanceof FloatBinding) return new FloatSerializer( (FloatBinding) binding );
+ if (binding instanceof DoubleBinding) return new DoubleSerializer( (DoubleBinding) binding );
+ if (binding instanceof StringBinding) return new ModifiedUTF8StringSerializer( (StringBinding) binding );
+
+ // Record
+ if (binding instanceof RecordBinding) {
+ RecordBinding b = (RecordBinding) binding;
+ Binding[] componentBindings = b.getComponentBindings();
+ int count = b.getComponentCount();
+
+ if ( b.type().isReferable() ) {
+ ReferableRecordSerializer result = new ReferableRecordSerializer(b, null);
+ inprogress.put(binding, result);
+ result.componentSerializers = new Serializer[count];
+ for (int i=0; i