users@jaxb.java.net

Re: enhancing object model?

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 20 Jul 2006 18:47:07 -0700

Frank Langelage wrote:
> We generate classes from an thirdparty schema to read B2B XMLs.
>
> An element of complex type Feature has an element of the complex type
> Option inside, maxoccurs unbounded.
> So the Feature class has "List<Option> option".
>
> Is it possible to get additionally an property of type option into the
> class feature, ideally filled with the first element of the list:
> class Feature {
> List<Option> option;
> Option firstOption;
> ...
> }.

You can't get that as a field, but it should be possible to write a
plugin that generates the following method:

   public Option getFirstOption() {
     return option.get(0);
   }

I'm not sure if this is a generally useful thing, however, so it's
probably best for you to consider a plugin route.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com