branch feature/5 created (now 62d4fa0)
This is an automated email from the git hooks/post-receive script. New change to branch feature/5 in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git at 62d4fa0 Correction de la désérialisation d'une ImmutableMap (Closes #5) This branch includes the following new commits: new 62d4fa0 Correction de la désérialisation d'une ImmutableMap (Closes #5) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 62d4fa0abec6017eb80442fc00b4544e9ec6dd01 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Dec 20 10:58:09 2016 +0100 Correction de la désérialisation d'une ImmutableMap (Closes #5) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/5 in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit 62d4fa0abec6017eb80442fc00b4544e9ec6dd01 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Dec 20 10:58:09 2016 +0100 Correction de la désérialisation d'une ImmutableMap (Closes #5) --- .../ird/observe/services/dto/gson/ImmutableMultimapAdapter.java | 2 +- .../fr/ird/observe/services/dto/gson/MultimapAdapterSupport.java | 2 +- .../fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java index 2a257f7..472eaac 100644 --- a/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java +++ b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java @@ -57,7 +57,7 @@ public class ImmutableMultimapAdapter implements JsonSerializer<ImmutableMultima Type keyType = actualTypeArguments[0]; Type valueType = actualTypeArguments[1]; - Type type2 = ObserveDtoGsonSupplier.mapOf(TypeToken.of(keyType), TypeToken.of(valueType)).getType(); + Type type2 = ObserveDtoGsonSupplier.multimapOf(TypeToken.of(keyType), TypeToken.of(valueType)).getType(); Map map = context.deserialize(json, type2); for (Object key : map.keySet()) { diff --git a/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/MultimapAdapterSupport.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/MultimapAdapterSupport.java index f2ee6e1..1d041d9 100644 --- a/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/MultimapAdapterSupport.java +++ b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/MultimapAdapterSupport.java @@ -51,7 +51,7 @@ public abstract class MultimapAdapterSupport<M extends Multimap> implements Json Type keyType = actualTypeArguments[0]; Type valueType = actualTypeArguments[1]; - Type type2 = ObserveDtoGsonSupplier.mapOf(TypeToken.of(keyType), TypeToken.of(valueType)).getType(); + Type type2 = ObserveDtoGsonSupplier.multimapOf(TypeToken.of(keyType), TypeToken.of(valueType)).getType(); Map map = context.deserialize(json, type2); M result = createMultimap(); diff --git a/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java index c321c31..d5c401c 100644 --- a/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java +++ b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java @@ -78,7 +78,13 @@ public class ObserveDtoGsonSupplier implements Supplier<Gson> { this.prettyPrint = prettyPrint; } - public static <K, V> TypeToken<Map<K, Collection<V>>> mapOf(TypeToken<K> keyType, TypeToken<V> valueType) { + public static <K, V> TypeToken<Map<K, V>> mapOf(TypeToken<K> keyType, TypeToken<V> valueType) { + return new TypeToken<Map<K, V>>() {} + .where(new TypeParameter<K>() {}, keyType) + .where(new TypeParameter<V>() {}, valueType); + } + + public static <K, V> TypeToken<Map<K, Collection<V>>> multimapOf(TypeToken<K> keyType, TypeToken<V> valueType) { return new TypeToken<Map<K, Collection<V>>>() {} .where(new TypeParameter<K>() {}, keyType) .where(new TypeParameter<V>() {}, valueType); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm