You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Robert Panzer (JIRA)" <ji...@apache.org> on 2016/05/31 07:33:12 UTC

[jira] [Commented] (JOHNZON-80) Serialization of Maps should take AttributeOrder into account

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

Robert Panzer commented on JOHNZON-80:
--------------------------------------

Kind of disagree.
Sorting is not an aspect of the data structure, but of the act of serialization.
People for instance tend to serialize objects to JSON and compare them in tests.
While the AttributeOrder stabilizes these tests for all attributes it cannot be used as soon as maps are involved.

I understand that this can be very expensive for large maps. Maybe it might make sense to also do this optionally. 
Maybe with an annotation on the corresponding property accessor?

But I am perfectly fine with refusing this. 

> Serialization of Maps should take AttributeOrder into account
> -------------------------------------------------------------
>
>                 Key: JOHNZON-80
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-80
>             Project: Johnzon
>          Issue Type: Improvement
>          Components: Mapper
>    Affects Versions: 0.9.2-incubating
>            Reporter: Robert Panzer
>
> MapperBuilder allows to pass a java.util.Comparator to define the AttributeOrder, e.g. write Object properties in their lexicographic order.
> It seems that this order is ignored when java.util.Maps are serialized.
> It would be nice if the AttributeOrder would be used in this case as well.
> Tested on Johnzon 0.9.2-incubating, but looking at the current master it seems that this behavior is still in place even though the code was a bit refactored.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)