You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by Hendrik Dev <he...@gmail.com> on 2014/08/15 21:39:00 UTC

Mapper: how to map char and char[]

Given a class like

  public static class CharClass {

        private char charValue;
        private char charArr[];

        public char[] getCharArr() {
            return charArr;
        }

        public void setCharArr(char[] charArr) {
            this.charArr = charArr;
        }

        public char getCharValue() {
            return charValue;
        }

        public void setCharValue(char charValue) {
            this.charValue = charValue;
        }

    }

how to we want to map char (assume 'U') and char[] (assume 'G','O') ?

Something like;

{"charArr":["G","O"],"charValue":"U"} OR
{"charArr":"GO","charValue":"U"} OR
{"charArr":[71,79],"charValue":85} OR
...

I would go for {"charArr":"GO","charValue":"U"} because its IMHO that
what one would expect.

Wdyt?

Hendrik

-- 
Hendrik Saly (salyh, hendrikdev22)
@hendrikdev22
PGP: 0x22D7F6EC

Re: Mapper: how to map char and char[]

Posted by Hendrik Dev <he...@gmail.com>.
done
https://issues.apache.org/jira/browse/FLEECE-14

On Sat, Aug 16, 2014 at 12:20 PM, Romain Manni-Bucau
<rm...@gmail.com> wrote:
> Great
>
> If you can create a patch for jira after having removed null handling
> (allowing null to be dumped needs a specific config in builder since most
> of the time you dont want it at all).
>
> About null i was thinking handling it when asked by users not before
> Le 16 août 2014 00:23, "Hendrik Dev" <he...@gmail.com> a écrit :
>
>> no current serialization :-(
>>
>> {"charArr":[{},{}],"charValue":{}}
>>
>> instead of
>>
>> {"charArr":["G","O"],"charValue":"G"}
>>
>> Here is a proposal to fix char, boolean and null handling
>>
>> https://github.com/salyh/fleece_master/commit/656886f92b58f6bb9e447f8a4e942c6f21bdb15d
>>
>> (null handling i am a little bit unsure if this is what we want)
>>
>> Kind regards
>> Hendrik
>>
>> On Fri, Aug 15, 2014 at 10:45 PM, Romain Manni-Bucau
>> <rm...@gmail.com> wrote:
>> > First one for sure. Array stucture should be kept otherwise use a string.
>> >
>> > Ps: what is current serialization?
>> > Le 15 août 2014 21:39, "Hendrik Dev" <he...@gmail.com> a écrit :
>> >
>> >> Given a class like
>> >>
>> >>   public static class CharClass {
>> >>
>> >>         private char charValue;
>> >>         private char charArr[];
>> >>
>> >>         public char[] getCharArr() {
>> >>             return charArr;
>> >>         }
>> >>
>> >>         public void setCharArr(char[] charArr) {
>> >>             this.charArr = charArr;
>> >>         }
>> >>
>> >>         public char getCharValue() {
>> >>             return charValue;
>> >>         }
>> >>
>> >>         public void setCharValue(char charValue) {
>> >>             this.charValue = charValue;
>> >>         }
>> >>
>> >>     }
>> >>
>> >> how to we want to map char (assume 'U') and char[] (assume 'G','O') ?
>> >>
>> >> Something like;
>> >>
>> >> {"charArr":["G","O"],"charValue":"U"} OR
>> >> {"charArr":"GO","charValue":"U"} OR
>> >> {"charArr":[71,79],"charValue":85} OR
>> >> ...
>> >>
>> >> I would go for {"charArr":"GO","charValue":"U"} because its IMHO that
>> >> what one would expect.
>> >>
>> >> Wdyt?
>> >>
>> >> Hendrik
>> >>
>> >> --
>> >> Hendrik Saly (salyh, hendrikdev22)
>> >> @hendrikdev22
>> >> PGP: 0x22D7F6EC
>> >>
>>
>>
>>
>> --
>> Hendrik Saly (salyh, hendrikdev22)
>> @hendrikdev22
>> PGP: 0x22D7F6EC
>>



-- 
Hendrik Saly (salyh, hendrikdev22)
@hendrikdev22
PGP: 0x22D7F6EC

Re: Mapper: how to map char and char[]

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Great

If you can create a patch for jira after having removed null handling
(allowing null to be dumped needs a specific config in builder since most
of the time you dont want it at all).

About null i was thinking handling it when asked by users not before
Le 16 août 2014 00:23, "Hendrik Dev" <he...@gmail.com> a écrit :

> no current serialization :-(
>
> {"charArr":[{},{}],"charValue":{}}
>
> instead of
>
> {"charArr":["G","O"],"charValue":"G"}
>
> Here is a proposal to fix char, boolean and null handling
>
> https://github.com/salyh/fleece_master/commit/656886f92b58f6bb9e447f8a4e942c6f21bdb15d
>
> (null handling i am a little bit unsure if this is what we want)
>
> Kind regards
> Hendrik
>
> On Fri, Aug 15, 2014 at 10:45 PM, Romain Manni-Bucau
> <rm...@gmail.com> wrote:
> > First one for sure. Array stucture should be kept otherwise use a string.
> >
> > Ps: what is current serialization?
> > Le 15 août 2014 21:39, "Hendrik Dev" <he...@gmail.com> a écrit :
> >
> >> Given a class like
> >>
> >>   public static class CharClass {
> >>
> >>         private char charValue;
> >>         private char charArr[];
> >>
> >>         public char[] getCharArr() {
> >>             return charArr;
> >>         }
> >>
> >>         public void setCharArr(char[] charArr) {
> >>             this.charArr = charArr;
> >>         }
> >>
> >>         public char getCharValue() {
> >>             return charValue;
> >>         }
> >>
> >>         public void setCharValue(char charValue) {
> >>             this.charValue = charValue;
> >>         }
> >>
> >>     }
> >>
> >> how to we want to map char (assume 'U') and char[] (assume 'G','O') ?
> >>
> >> Something like;
> >>
> >> {"charArr":["G","O"],"charValue":"U"} OR
> >> {"charArr":"GO","charValue":"U"} OR
> >> {"charArr":[71,79],"charValue":85} OR
> >> ...
> >>
> >> I would go for {"charArr":"GO","charValue":"U"} because its IMHO that
> >> what one would expect.
> >>
> >> Wdyt?
> >>
> >> Hendrik
> >>
> >> --
> >> Hendrik Saly (salyh, hendrikdev22)
> >> @hendrikdev22
> >> PGP: 0x22D7F6EC
> >>
>
>
>
> --
> Hendrik Saly (salyh, hendrikdev22)
> @hendrikdev22
> PGP: 0x22D7F6EC
>

Re: Mapper: how to map char and char[]

Posted by Hendrik Dev <he...@gmail.com>.
no current serialization :-(

{"charArr":[{},{}],"charValue":{}}

instead of

{"charArr":["G","O"],"charValue":"G"}

Here is a proposal to fix char, boolean and null handling
https://github.com/salyh/fleece_master/commit/656886f92b58f6bb9e447f8a4e942c6f21bdb15d

(null handling i am a little bit unsure if this is what we want)

Kind regards
Hendrik

On Fri, Aug 15, 2014 at 10:45 PM, Romain Manni-Bucau
<rm...@gmail.com> wrote:
> First one for sure. Array stucture should be kept otherwise use a string.
>
> Ps: what is current serialization?
> Le 15 août 2014 21:39, "Hendrik Dev" <he...@gmail.com> a écrit :
>
>> Given a class like
>>
>>   public static class CharClass {
>>
>>         private char charValue;
>>         private char charArr[];
>>
>>         public char[] getCharArr() {
>>             return charArr;
>>         }
>>
>>         public void setCharArr(char[] charArr) {
>>             this.charArr = charArr;
>>         }
>>
>>         public char getCharValue() {
>>             return charValue;
>>         }
>>
>>         public void setCharValue(char charValue) {
>>             this.charValue = charValue;
>>         }
>>
>>     }
>>
>> how to we want to map char (assume 'U') and char[] (assume 'G','O') ?
>>
>> Something like;
>>
>> {"charArr":["G","O"],"charValue":"U"} OR
>> {"charArr":"GO","charValue":"U"} OR
>> {"charArr":[71,79],"charValue":85} OR
>> ...
>>
>> I would go for {"charArr":"GO","charValue":"U"} because its IMHO that
>> what one would expect.
>>
>> Wdyt?
>>
>> Hendrik
>>
>> --
>> Hendrik Saly (salyh, hendrikdev22)
>> @hendrikdev22
>> PGP: 0x22D7F6EC
>>



-- 
Hendrik Saly (salyh, hendrikdev22)
@hendrikdev22
PGP: 0x22D7F6EC

Re: Mapper: how to map char and char[]

Posted by Romain Manni-Bucau <rm...@gmail.com>.
First one for sure. Array stucture should be kept otherwise use a string.

Ps: what is current serialization?
Le 15 août 2014 21:39, "Hendrik Dev" <he...@gmail.com> a écrit :

> Given a class like
>
>   public static class CharClass {
>
>         private char charValue;
>         private char charArr[];
>
>         public char[] getCharArr() {
>             return charArr;
>         }
>
>         public void setCharArr(char[] charArr) {
>             this.charArr = charArr;
>         }
>
>         public char getCharValue() {
>             return charValue;
>         }
>
>         public void setCharValue(char charValue) {
>             this.charValue = charValue;
>         }
>
>     }
>
> how to we want to map char (assume 'U') and char[] (assume 'G','O') ?
>
> Something like;
>
> {"charArr":["G","O"],"charValue":"U"} OR
> {"charArr":"GO","charValue":"U"} OR
> {"charArr":[71,79],"charValue":85} OR
> ...
>
> I would go for {"charArr":"GO","charValue":"U"} because its IMHO that
> what one would expect.
>
> Wdyt?
>
> Hendrik
>
> --
> Hendrik Saly (salyh, hendrikdev22)
> @hendrikdev22
> PGP: 0x22D7F6EC
>