Hum, I don't know if it is worth to make deser order customizable. The only
use case I see where someone would want parent fields to be set first is
when he does some ugly init. logic in setters and the order matters. And
this use case sounds as bad code. Also this is too technical and low level
IMO to let the user configure anything. I'd say, let him configure the
order props are being ser. and thats all.
2015-03-17 11:11 GMT+01:00 Martin Vojtek <voytoo_at_gmail.com>:
> Hi Eugen, agree with performance issue. Let's set it in order.
>
> It should be customizable to allow other options.
>
> On Tue, Mar 17, 2015 at 10:58 AM, Eugen Cepoi <cepoi.eugen_at_gmail.com>
> wrote:
>
>> OK for 1 and 2, but I disagree with 3. It is inefficient, during deser.
>> lets "set" them in the order they appear in the stream.
>>
>> 2015-03-17 10:08 GMT+01:00 Martin Vojtek <voytoo_at_gmail.com>:
>>
>>> I suggest the following default for inheritance, order of fields (for
>>> default mapping):
>>>
>>> 1. Fields MUST be marshalled(serialized) in lexicographical order.
>>> 2. Fields of super class MUST be marshalled(serialized) before fields of
>>> child class.
>>> 3. When unmarshalling, fields of super class MUST be set before fields
>>> of child class.
>>>
>>>
>>> ad examples: I will add examples for suggested cases. In general, feel
>>> free to
>>> send me diff file or create some github fork to propose changes/examples
>>> and I will incorporate it (if you don't have commit rights).
>>>
>>>
>>> MartinV
>>>
>>> On Mon, Mar 16, 2015 at 2:03 PM, Przemyslaw Bielicki <
>>> pbielicki_at_gmail.com> wrote:
>>>
>>>> 1. Do we rellly want to specify ordering of POJO fields based on
>>>>> lexicographic order of field names?
>>>>> I think better rely on fields order of appearance in class as it done
>>>>> in Gson.
>>>>>
>>>>
>>>> Eugen is completely right here. The order is nor guaranteed in runtime.
>>>>
>>>>
>>>>>
>>>>> 2. Inheritance, order of fields. Should we specify default order of
>>>>> fields when using inheritance? Which field set is to be first - fields of
>>>>> subclass or fields of superclass? In gson superclass fields go first.
>>>>>
>>>>
>>>> Good point. As usual let's come up with a reasonable and proved default
>>>> + @Annotation to override it for advanced users.
>>>>
>>>>
>>>>> 4. Lets add examples for POJO classes wth Collections/Arrays fields
>>>>> (one to many relation).
>>>>>
>>>>>
>>>> I think you're more than welcome to commit you changes :)
>>>>
>>>> Cheers,
>>>> Przemyslaw
>>>>
>>>>
>>>>
>>>
>>
>