johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Vanderham <twelve.eig...@gmail.com>
Subject Re: How to patch the documentation for @JohnzonAny?
Date Sun, 19 May 2019 19:38:53 GMT
For sure, I can do a pull request through GitHub.

On Sun, May 19, 2019 at 1:02 PM Romain Manni-Bucau
<rmannibucau@gmail.com> wrote:
>
> I think our default contribution workflow implies github, is it ok for you
> to do a pull request against https://github.com/apache/johnzon ?
>
> If not it is fine as well and I can apply this patch tomorrow too.
>
> Le dim. 19 mai 2019 à 20:02, Frank Vanderham <twelve.eighty@gmail.com> a
> écrit :
>
> > I wasn't sure if the mailing list supports attachments or not, so I'll
> > put the patch inline in the text below. Let me know if it's easier for
> > me to just attach a .patch file.
> >
> > Of course, also please review the patch for correctness. I'm open to
> > suggestions.
> >
> > ==========
> > diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md
> > index db026f0..37cee75 100644
> > --- a/src/site/markdown/index.md
> > +++ b/src/site/markdown/index.md
> > @@ -187,9 +187,15 @@ If you don't fully know you model but want to
> > handle all keys you can use @Johnz
> >
> >  <pre class="prettyprint linenums"><![CDATA[
> >  public class AnyMe {
> > -    @JohnzonAny // ignore normal serialization of this field
> > -    private String name; // known
> > -    private Map<String, Object> any = new TreeMap<String, Object>();
//
> > unknown
> > +    private String name; // Regular serialization for the known 'name'
> > field
> > +
> > +    /* This example uses a TreeMap to store and retrieve the other unknown
> > +       fields for the @JohnzonAny annotated methods, but you can choose
> > +       anything you want. Use @JohnzonIgnore to avoid exposing this as
> > +       an actual 'unknownFields' property in JSON.
> > +    */
> > +    @JohnzonIgnore
> > +    private Map<String, Object> unknownFields = new TreeMap<String,
> > Object>();
> >
> >      public String getName() {
> >          return name;
> > @@ -199,14 +205,14 @@ public class AnyMe {
> >          this.name = name;
> >      }
> >
> > -    @Any
> > +    @JohnzonAny
> >      public Map<String, Object> getAny() {
> > -        return any;
> > +        return unknownFields;
> >      }
> >
> > -    @Any
> > +    @JohnzonAny
> >      public void handle(final String key, final Object val) {
> > -        any.put(key, val);
> > +        this.unknownFields.put(key, val);
> >      }
> >  }
> >  ]]></pre>
> > ==========
> >

Mime
View raw message