users@jaxb.java.net

Re: [Issue 115] Supports Method Chaining/ FluentAPI

From: Hanson Char <hanson.char_at_gmail.com>
Date: Mon, 30 Jan 2006 13:33:12 -0800

Nice!

There is a minor typo:

BigDeciaml => BigDecimal

Probably due to cut-n-paste from the original page, which I just fixed.

Hanson

On 1/30/06, Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com> wrote:
>
>
> This was highlighted at the aquarium:
>
>
> http://blogs.sun.com/roller/page/theaquarium?entry=adding_support_for_methodchaining_to
>
> Once again, nice work, Hanson!
>
> Hanson Char wrote:
> > Hi,
> >
> > I am trying to write a xjc plugin to support a fluent api in addition to
> the
> > default (JavaBean) setter methods.
> >
> > The initial idea is simply to add a "with*" method to the generated
> class
> > (via JDefinedClass.method) for every "set*" method encountered, with the
> > only difference of returning the class instance, instead of void.
> >
> > In creating a "with*" method, I am trying to clone across the modifiers
> of
> > the corresponding setter method. These modifiers can be accessed via
> > JMethod.getMods() which is of type JMods. However, although JMods has
> an
> > internal "mods" int field, there seems no API to gain access to it. (I
> > don't want to resort to reflection to break the API.) Meanwhile, the
> > required "mods" parameter of JDefinedClass.method is an int.
> >
> > Any chance this can be changed ?
> > ie.
> >
> > 1. Either JDefinedClass.method should allow passing in a JMods
> instead
> > of int for the modifiers; or
> > 2. JMods should provide a getter method to its internal "mods".
> >
> > Does this make sense ?
> >
> > Hanson
> >
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>