johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Change default converter suggestion
Date Fri, 15 Mar 2019 14:27:24 GMT
You can extend existing provider, it was done for that and to avoid to impl
a token literal just for config (needed for generics) - this is out of
scope of johnzon but can be in xbean.

Le ven. 15 mars 2019 à 15:01, Jean-Louis Monteiro <jlmonteiro@tomitribe.com>
a écrit :

> Hey Romain,
>
> I was looking at Ivan's example and I think I understand what is the issue.
> Basically he's using the configurable provider but we don't have any
> wrapper method around the Mapper to add a new adapter.
>
> I created a quick and dirty PR on his project to show him how he can do,
> but we can probably make it easier if we add the wrappers ourselves in the
> configuration provider.
>
> Obviously the reflection is very quick and dirty so we would need to change
> it.
>
> https://github.com/ivanjunckes/convertertest/pull/1
>
>
>
>
> --
> Jean-Louis Monteiro
> http://twitter.com/jlouismonteiro
> http://www.tomitribe.com
>
>
> On Fri, Mar 15, 2019 at 1:23 PM Ivan Junckes Filho <ivanjunckes@gmail.com>
> wrote:
>
> > Is it possible that you point an example Romain?
> >
> > On Thu, Mar 14, 2019 at 6:52 PM Romain Manni-Bucau <
> rmannibucau@gmail.com>
> > wrote:
> >
> > > Just call builder.addAdapter passing your custom date formatter and it
> > will
> > > do what you asks. It replaces the default converter globally. No need
> of
> > > any model change.
> > >
> > > Le jeu. 14 mars 2019 à 21:04, Ivan Junckes Filho <
> ivanjunckes@gmail.com>
> > a
> > > écrit :
> > >
> > > > Dani it could be.. but a simple way to change the date format would
> be
> > > > better.
> > > >
> > > > Romain, can you elaborate? I am not sure I understand.
> > > >
> > > > On Thu, Mar 14, 2019 at 1:24 PM Romain Manni-Bucau <
> > > rmannibucau@gmail.com>
> > > > wrote:
> > > >
> > > > > Hmm, normally set on the builder and not the annotation it works
as
> > you
> > > > > describes.
> > > > >
> > > > > Le jeu. 14 mars 2019 à 16:00, Ivan Junckes Filho <
> > > ivanjunckes@gmail.com>
> > > > a
> > > > > écrit :
> > > > >
> > > > > > I tried based on the blog but didn't work.
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://rmannibucau.wordpress.com/2015/07/09/javaee-apache-johnzon-json-library-javascript-date/
> > > > > >
> > > > > > See sample below:
> > > > > > https://github.com/ivanjunckes/convertertest
> > > > > >
> > > > > > But this doesn't also provide the same format for all "Date"
> > fields,
> > > I
> > > > > need
> > > > > > to go field by field and add the converter.
> > > > > >
> > > > > > On Thu, Mar 14, 2019 at 11:41 AM Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Ivan,
> > > > > > >
> > > > > > > We support it for jsonb and you can overriee default
> > > > > adapters/converters
> > > > > > in
> > > > > > > johnzon mapper already.
> > > > > > >
> > > > > > > Did you try that? Sounds to me we are already covered for
both
> > > > mappers.
> > > > > > Am
> > > > > > > I missing something?
> > > > > > >
> > > > > > > Romain
> > > > > > >
> > > > > > > Le jeu. 14 mars 2019 à 14:36, Ivan Junckes Filho <
> > > > > ivanjunckes@gmail.com>
> > > > > > a
> > > > > > > écrit :
> > > > > > >
> > > > > > > > Hey guys,
> > > > > > > >
> > > > > > > > I am from Brazil and would be useful to be able to
pass a
> > > property
> > > > in
> > > > > > the
> > > > > > > > date format from Brazil.
> > > > > > > >
> > > > > > > > Is it ok if I submit a PR changing the line below
to check it
> > > > > > > > "johnzon.default-date-format" has a value then use
it, if not
> > use
> > > > the
> > > > > > > > default yyyyMMddHHmmssZ.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/apache/johnzon/blob/f28196b39ae3d0ff2ccdd8b1e9efe2a5801e1e7f/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java#L81
> > > > > > > >
> > > > > > > > What do you think?
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message