users@jaxb.java.net

Re: Customize ObjectFactory

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 1 Jun 2010 17:41:37 +0200

On 1 June 2010 08:44, Lulseged Zerfu <lulseged.zerfu_at_ericsson.com> wrote:

> Hi
>
> 1. Is it possible to customize ObjectFactory? I have 20 schemas that are
> compiled to java and I get 20 ObjectFactories. Same class name but
> different.
>

Well, they are in different packages, aren't they? If not: try compiling
them all in a single xjc run.


> 2. Is it possible to customize so that when compiling to java, any elemnts
> are put into a List and other defined elements are put in Set or Vector?
>
> Example:
>
> If the schema is compiled, one can see ListType, EntryType, ExternalType
> and EntryReftype including AnyType are all put together mixed in a
> java.util.List. Is it possible to put only AnyType in to a java.util.List
> and the other known types in a java.util.Set or java.util.Vector? The order
> of the orignal xml document is not offen important.
>

If you write the schema differently, i.e., as a sequence of elements with
maxOccurs="unbounded", you'll have individual lists.

Order not important: Docbook would be a famous counter example.


>
> Instead of a method like getListOrExternalOrEntry() it will create get
> methods for each type, (getList(), getExternal(), getEntry(), getEntryRef()
> and getAny()).
>
> This was how it used to work in 2.1.6 or earlier.
>

Which was - rightly - considered to be a bug.

-W


>
> Lulseged
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>