1. CC-XJC

CC-XJC

Introduction

CC-XJC is a JAXB 2.0 XJC plugin for adding a copy constructor to schema derived classes. The plugin provides a '-copy-constructor' option which is enabled by adding its jar file to the XJC classpath. Additionally a '-cc-visibility' option can be specified taking an argument specifying the visibility of any copy methods generated by the plugin ('private, package, protected, public'). See the examples for further information.

Support

Development of CC-XJC is community driven. Please file any issues with the MantisBT bugtracker or subscribe to the ccxjc-users mailing list for discussing issues or asking questions. The IdeaTorrent is used to collect ideas. You may also want to use the wiki for providing content related to CC-XJC yourself. Please note that applications provided by Sourceforge require you to login to Sourceforge. If you do not have a Sourceforge account, simply create one at Sourceforge.

Examples

Maven

Maven users simply add the CC-XJC plugin as a dependency to a JAXB plugin of choice. For this to work, the CC-XJC repository needs to be put in a POM or the Maven settings.

<repository>
  <id>http://ccxjc.sourceforge.net/maven2/releases</id>
  <url>http://ccxjc.sourceforge.net/maven2/releases</url>
  <releases>
    <enabled>true</enabled>
  </releases>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
</repository>

The following example demonstrates the use of the CC-XJC plugin with the Java.net maven-jaxb-plugin.

<plugin>
  <groupId>com.sun.tools.xjc.maven2</groupId>
  <artifactId>maven-jaxb-plugin</artifactId>
  <version>1.1</version>
  <dependencies>
    <dependency>
      <groupId>net.sourceforge.ccxjc</groupId>
      <artifactId>cc-xjc-plugin</artifactId>
      <version>1.0-beta-7</version>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <id>generate</id>
      <phase>generate-sources</phase>
      <goals>
        <goal>generate</goal>
      </goals>
      <configuration>
        <schemaDirectory>src/main/schemas</schemaDirectory>
        <args>-copy-constructor -cc-visibility private</args>
        <extension>true</extension>
      </configuration>
    </execution>
  </executions>
</plugin>

Note: To use the Java.net maven-jaxb-plugin, the Java.net repositories need to be used in addition to the CC-XJC repository.

<repositories>
  <repository>
    <id>http://download.java.net/maven/1</id>
    <url>http://download.java.net/maven/1</url>
    <layout>legacy</layout>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </repository>
  <repository>
    <id>http://download.java.net/maven/2</id>
    <url>http://download.java.net/maven/2</url>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </repository>
</repositories>

<pluginRepositories>
  <pluginRepository>
    <id>http://download.java.net/maven/1</id>
    <url>http://download.java.net/maven/1</url>
    <layout>legacy</layout>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </pluginRepository>
  <pluginRepository>
    <id>http://download.java.net/maven/2</id>
    <url>http://download.java.net/maven/2</url>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </pluginRepository>
</pluginRepositories>

Download

Releases

Releases are deployed to the Sourceforge file release system. Please see the Sourceforge FRS. The changes report contains information regarding changes between releases.

Snapshots

Development snapshots are deployed to the CC-XJC snapshot repository and are available for download from there. Please see group net.sourceforge.ccxjc. Maven users may want to add the CC-XJC snapshot repository to a POM or the Maven settings.

<repository>
  <id>http://ccxjc.sourceforge.net/maven2/snapshots</id>
  <url>http://ccxjc.sourceforge.net/maven2/snapshots</url>
  <releases>
    <enabled>false</enabled>
  </releases>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
</repository>

License

The CC-XJC Project Copyright

Copyright (c) 2009 The CC-XJC Project. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE CC-XJC PROJECT AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CC-XJC PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.