polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Merlin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (POLYGENE-157) Remove support for legacy Map serialization format.
Date Mon, 27 Feb 2017 14:52:45 GMT

    [ https://issues.apache.org/jira/browse/POLYGENE-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15885885#comment-15885885
] 

Paul Merlin commented on POLYGENE-157:
--------------------------------------

I ended up with the following:

When serializing a Map, if all its keys are serialized to String, then serialize the Map as
a simple object.
Otherwise, serialize the Map as an array of entry objects.
When deserializing a Map, detect both formats.

In other words, Map<String, ?>, Map<ZonedDateTime, ?> and EnumMap<SomeEnum,
?> will be serialized as simple objects because their keys end up as Strings when serialized.
On the other hand, Map<Integer, ?> and Map<SomeValue, ?> will be serialized as
arrays of entry objects because their keys do not end up as Strings when serialized.

> Remove support for legacy Map serialization format.
> ---------------------------------------------------
>
>                 Key: POLYGENE-157
>                 URL: https://issues.apache.org/jira/browse/POLYGENE-157
>             Project: Polygene
>          Issue Type: Task
>            Reporter: Niclas Hedhman
>            Assignee: Paul Merlin
>             Fix For: 3.0
>
>
> In Qi4j 1.x, we serialized the Maps as
> [
>     { "key":"abc", "value":"def" )
> ]
> which in 2.x became
> {
>     "abc":"def"
> }
> We should remove the old format to make the code cleaner and less confusing.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message