Hi guys,
Happy that this question has been raised again.
+1 to more readable/fluent builder style JsonbConfig method names as we
proposed initially:
- JsonbConfig#withEncoding(UTF_16) or
JsonbConfig#inputEncoding/outputEncoding(UTF_16) (not sure should we
provide explicit support for users to specify diff input/output encodings.
really looks more like exotic use case. and at the end they always can use
JsonbConfig#setProperty(...) method if provider implementation supports
additional properties)
- JsonbConfig#withPrettyFormatting() as shortcut + additionally as
Inderjeet suggested we can provide
JsonbConfig#withFormatting(OutputFormat)
Basically behind the scenes all these convenient builder methods put
particular properties in Map and user can always put supported by
particular provider property explicitly in Map using
JsonbConfig#setProperty(...) method.
Thank you,
Oleg
2015-03-16 18:56 GMT+00:00 Inderjeet Singh <inder_at_alumni.stanford.edu>:
> Ah ok. Basically, a setPrettyPrinting() method, but done via properties.
>
> Seems reasonable, just to stay consistent with the other API.
>
> Overall, not a big fan, but can live with.
>
> On Mon, Mar 16, 2015 at 11:26 AM, Eugen Cepoi <cepoi.eugen_at_gmail.com>
> wrote:
>
>> Nothing crazy, it is just a config key to be used in a plain to
>> enables/disable pretty printing.
>> The key is defined in JsonGenerator and passed to the factory.
>>
>> http://docs.oracle.com/javaee/7/api/javax/json/stream/JsonGenerator.html
>>
>> https://javaee-spec.java.net/nonav/javadocs/javax/json/stream/class-use/JsonGeneratorFactory.html
>>
>> 2015-03-16 19:12 GMT+01:00 Inderjeet Singh <inder_at_alumni.stanford.edu>:
>>
>>> I am not as familiar with how this is done in jsonp. Can you give me a
>>> pointer?
>>> Thanks
>>> Inder
>>>
>>> On Mon, Mar 16, 2015 at 11:05 AM, Romain Manni-Bucau <
>>> rmannibucau_at_tomitribe.com> wrote:
>>>
>>>> Well on that topic I'd stay aligned with jsonp.
>>>>
>>>> Plus each time I saw such an API it was never used or badly used - json
>>>> to xml formatter comes immediately to my mind.
>>>> Le 16 mars 2015 18:51, "Inderjeet Singh" <inder_at_alumni.stanford.edu> a
>>>> écrit :
>>>>
>>>>
>>>>>
>>>>> On Mon, Mar 16, 2015 at 9:50 AM, Romain MB <rmannibucau_at_tomitribe.com>
>>>>> wrote:
>>>>>
>>>>>> 2015-03-16 17:35 GMT+01:00 Eugen Cepoi <cepoi.eugen_at_gmail.com>:
>>>>>> >
>>>>>> >
>>>>>> > 2015-03-16 17:21 GMT+01:00 Inderjeet Singh <
>>>>>> inder_at_alumni.stanford.edu>:
>>>>>> >>
>>>>>> >> In Gson, we have a GsonBuilder.setPrettyPrinting() setting. This
>>>>>> mostly
>>>>>> >> works but is inflexible.
>>>>>> >> However, I think a better approach is to allow a formatter object
>>>>>> that
>>>>>> >> allows configuration per any formatting styles. You can use the
>>>>>> formatting
>>>>>> >> styles of an IDE such as Eclipse.
>>>>>> >
>>>>>>
>>>>>
>>
>