users@jaxb.java.net

Re: Generating Java bindings in different packages

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Mon, 25 Oct 2010 14:32:54 +0200

xjc generates enum types from xs:string with restriction/enumeration. It
should, however, be possible to use an Adapter to map the Schema type
to your model enum types.
-W

On 25 October 2010 12:20, Jean_at_Eastcode <jean.eastcode_at_gmail.com> wrote:

>
> Hi,
>
> I'm using jaxb2-maven-plugin to get automatic generation of my Java
> bindings
> from XSDs.
>
> I'm introducing the use of Enums, hence I have to create simpleTypes that
> maps the Java Enum values.
>
> The XSD as well as the generated classes are all in a binding "package"
>
> The enums are in a different package since they are not autogenerated,
> called "model".
>
> I want the generated classes to use the original Java "model" enum, but
> jaxb
> keep generating them into "binding".
>
> I've split all the simpleType corresponding to the Java enums in a
> EnumTypes.xsd that I put in "model" but still, corresponding Java enums are
> always created in "binding".
>
> Is there a way to generate EnumsTypes.xsd classes in "model", and to have
> classes generated into "binding" be linked to them?
>
> FYI, here's my plugin config:
>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>jaxb2-maven-plugin</artifactId>
> <version>1.3</version>
> <executions>
> <execution>
> <id>binding</id>
> <goals>
> <goal>xjc</goal>
> </goals>
> <configuration>
>
>
> <schemaDirectory>src/main/resources/com//comp/project/app/common/binding</schemaDirectory>
>
> <packageName>com.comp.project.app.common.binding</packageName>
>
> <outputDirectory>src/main/generated</outputDirectory>
> <clearOutputDir>false</clearOutputDir>
> </configuration>
> </execution>
> <execution>
> <id>model</id>
> <goals>
> <goal>xjc</goal>
> </goals>
> <configuration>
>
>
> <schemaDirectory>src/main/resources/com/comp/project/app/common/model</schemaDirectory>
>
> <packageName>com.comp.project.app.common.model</packageName>
>
> <outputDirectory>src/main/generated</outputDirectory>
> <clearOutputDir>false</clearOutputDir>
> </configuration>
> </execution>
> </executions>
>
> cheers
>
>
> --
> View this message in context:
> http://old.nabble.com/Generating-Java-bindings-in-different-packages-tp30046469p30046469.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>