Thread: [ccxjc-svn] SF.net SVN: ccxjc:[2] trunk
Brought to you by:
chanscte,
schulte2005
From: <sch...@us...> - 2009-05-02 02:01:20
|
Revision: 2 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=2&view=rev Author: schulte2005 Date: 2009-05-02 01:37:12 +0000 (Sat, 02 May 2009) Log Message: ----------- o Initial import. Added Paths: ----------- trunk/LICENSE.txt trunk/pom.xml trunk/src/ trunk/src/main/ trunk/src/main/assembly/ trunk/src/main/assembly/bin.xml trunk/src/main/books/ trunk/src/main/books/cc-xjc-manual.xml trunk/src/main/java/ trunk/src/main/java/net/ trunk/src/main/java/net/sourceforge/ trunk/src/main/java/net/sourceforge/ccxjc/ trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/src/main/javadoc/ trunk/src/main/javadoc/net/ trunk/src/main/javadoc/net/sourceforge/ trunk/src/main/javadoc/net/sourceforge/ccxjc/ trunk/src/main/javadoc/net/sourceforge/ccxjc/package.html trunk/src/main/resources/ trunk/src/main/resources/META-INF/ trunk/src/main/resources/META-INF/services/ trunk/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin trunk/src/main/resources/net/ trunk/src/main/resources/net/sourceforge/ trunk/src/main/resources/net/sourceforge/ccxjc/ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties trunk/src/site/ trunk/src/site/apt/ trunk/src/site/apt/index.apt trunk/src/site/apt/license-info.apt trunk/src/site/apt/maven.apt trunk/src/site/site.xml Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Added: svn:ignore + target .LICENSE.txt.swp Added: trunk/LICENSE.txt =================================================================== --- trunk/LICENSE.txt (rev 0) +++ trunk/LICENSE.txt 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,25 @@ +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. Property changes on: trunk/LICENSE.txt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/pom.xml =================================================================== --- trunk/pom.xml (rev 0) +++ trunk/pom.xml 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,437 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>net.sourceforge.ccxjc</groupId> + <artifactId>cc-xjc-plugin</artifactId> + <packaging>jar</packaging> + <name>CC-XJC</name> + <version>1.0-beta-1-SNAPSHOT</version> + <description><![CDATA[ + JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to + schema derived classes.]]> + </description> + <url>http://ccxjc.sourceforge.net</url> + <inceptionYear>2009</inceptionYear> + <organization> + <name>The CC-XJC Community</name> + <url>http://ccxjc.sourceforge.net</url> + </organization> + <licenses> + <license> + <name>The CC-XJC Project Copyright</name> + <url>http://ccxjc.sourceforge.net/LICENSE.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + <developers> + <developer> + <id>schulte2005</id> + <name>Christian Schulte</name> + </developer> + </developers> + <issueManagement> + <system>MantisBT</system> + <url>https://apps.sourceforge.net/mantisbt/ccxjc/</url> + </issueManagement> + <mailingLists> + <mailingList> + <name>ccxjc-users</name> + <subscribe>http://lists.sourceforge.net/lists/listinfo/ccxjc-users</subscribe> + <unsubscribe>http://lists.sourceforge.net/lists/listinfo/ccxjc-users</unsubscribe> + <post>ccx...@li...</post> + <archive>http://sourceforge.net/mailarchive/forum.php?forum=ccxjc-users</archive> + </mailingList> + <mailingList> + <name>ccxjc-svn</name> + <subscribe>http://lists.sourceforge.net/lists/listinfo/ccxjc-svn</subscribe> + <unsubscribe>http://lists.sourceforge.net/lists/listinfo/ccxjc-svn</unsubscribe> + <post>ccx...@li...</post> + <archive>http://sourceforge.net/mailarchive/forum.php?forum=ccxjc-svn</archive> + </mailingList> + </mailingLists> + <scm> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> + </scm> + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>${basedir}</directory> + <targetPath>META-INF</targetPath> + <includes> + <include>LICENSE.txt</include> + </includes> + </resource> + </resources> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> + <configuration> + <source>1.5</source> + <target>1.5</target> + <debug>true</debug> + <encoding>UTF-8</encoding> + <optimize>true</optimize> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> + </configuration> + </plugin> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <version>2.0</version> + <configuration> + <inputEncoding>UTF-8</inputEncoding> + <outputEncoding>UTF-8</outputEncoding> + <locales>en</locales> + </configuration> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.3</version> + <configuration> + <encoding>UTF-8</encoding> + </configuration> + </plugin> + <plugin> + <artifactId>buildnumber-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>1.0-beta-2</version> + <executions> + <execution> + <id>create-buildnumber</id> + <inherited>false</inherited> + <phase>validate</phase> + <goals> + <goal>create</goal> + </goals> + <configuration> + <format>{0,date,yyyy-MM-dd'T'HH:mm:ssZ}</format> + <items> + <item>timestamp</item> + </items> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-release-plugin</artifactId> + <version>2.0-beta-9</version> + <configuration> + <tagBase>https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags</tagBase> + </configuration> + </plugin> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <index>true</index> + <addMavenDescriptor>false</addMavenDescriptor> + <compress>true</compress> + <manifestEntries> + <Build-Date>${buildNumber}</Build-Date> + </manifestEntries> + </archive> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.4.3</version> + <configuration> + <forkMode>once</forkMode> + <skip>false</skip> + </configuration> + </plugin> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>2.3</version> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.4</version> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <version>2.3</version> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.2-beta-3</version> + <executions> + <execution> + <id>bin</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptors> + <descriptor>src/main/assembly/bin.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-source-plugin</artifactId> + <version>2.1</version> + <configuration> + <archive> + <index>true</index> + <addMavenDescriptor>false</addMavenDescriptor> + <compress>true</compress> + <manifestEntries> + <Build-Date>${buildNumber}</Build-Date> + </manifestEntries> + </archive> + </configuration> + </plugin> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + <version>2.5</version> + <configuration> + <archive> + <index>true</index> + <addMavenDescriptor>false</addMavenDescriptor> + <compress>true</compress> + <manifestEntries> + <Build-Date>${buildNumber}</Build-Date> + </manifestEntries> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-maven-plugin</artifactId> + <version>1.1</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>render-books</goal> + </goals> + </execution> + </executions> + <configuration> + <books> + <book> + <directory>src/site/apt</directory> + <descriptor>src/main/books/cc-xjc-manual.xml</descriptor> + <formats> + <format> + <id>xhtml</id> + </format> + </formats> + </book> + </books> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <artifactId>buildnumber-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + </plugin> + <plugin> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-maven-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + <reporting> + <plugins> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>2.1.1</version> + </plugin> + <plugin> + <artifactId>maven-changes-plugin</artifactId> + <version>2.1</version> + <configuration> + <issueLinkTemplatePerSystem> + <MantisBT>https://apps.sourceforge.net/mantisbt/ccxjc/view.php?id=%ISSUE%</MantisBT> + </issueLinkTemplatePerSystem> + <reportSets> + <reportSet> + <reports> + <report>changes-report</report> + </reports> + </reportSet> + </reportSets> + </configuration> + </plugin> + </plugins> + </reporting> + <dependencies> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>${jaxbApiVersion}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>${jaxbImplVersion}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-xjc</artifactId> + <version>${jaxbImplVersion}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <repositories> + <repository> + <id>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> + <url>http://download.java.net/maven/2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> + <url>http://download.java.net/maven/2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + <distributionManagement> + <repository> + <id>ccxjc-releases</id> + <name>CC-XJC Release Repository</name> + <url>scp://shell.sourceforge.net/home/groups/c/cc/ccxjc/htdocs/maven2/releases</url> + </repository> + <snapshotRepository> + <id>ccxjc-snapshots</id> + <name>CC-XJC Snapshot Repository</name> + <url>scp://shell.sourceforge.net/home/groups/c/cc/ccxjc/htdocs/maven2/snapshots</url> + </snapshotRepository> + <site> + <id>ccxjc-site</id> + <url>scp://shell.sourceforge.net/home/groups/c/cc/ccxjc/htdocs</url> + </site> + </distributionManagement> + <profiles> + <profile> + <id>create-sourceforge-shell</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.3</version> + <dependencies> + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant-jsch</artifactId> + <version>1.7.1</version> + </dependency> + </dependencies> + <executions> + <execution> + <id>create-sourceforge-shell</id> + <phase>validate</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + <sshexec host="shell.sourceforge.net" + username="${ccxjc.ssh.username},ccxjc" + password="${ccxjc.ssh.password}" + command="create" + timeout="300000"/> + + </tasks> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <properties> + <jaxbApiVersion>2.0</jaxbApiVersion> + <jaxbImplVersion>2.0.5</jaxbImplVersion> + </properties> +</project> Property changes on: trunk/pom.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/src/main/assembly/bin.xml =================================================================== --- trunk/src/main/assembly/bin.xml (rev 0) +++ trunk/src/main/assembly/bin.xml 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<assembly> + <id>bin</id> + <formats> + <format>tar.gz</format> + <format>tar.bz2</format> + <format>zip</format> + </formats> + <files> + <file> + <source>${project.build.directory}/generated-site/xhtml/cc-xjc-manual/cc-xjc-manual.xhtml</source> + <destName>CC-XJC ${pom.version}.html</destName> + <outputDirectory>/</outputDirectory> + <fileMode>0644</fileMode> + <filtered>false</filtered> + </file> + </files> + <dependencySets> + <dependencySet> + <fileMode>0755</fileMode> + </dependencySet> + </dependencySets> +</assembly> Property changes on: trunk/src/main/assembly/bin.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/src/main/books/cc-xjc-manual.xml =================================================================== --- trunk/src/main/books/cc-xjc-manual.xml (rev 0) +++ trunk/src/main/books/cc-xjc-manual.xml 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<book xmlns="http://maven.apache.org/BOOK/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/BOOK/1.0.0 ../../../doxia/doxia-book/target/generated-site/xsd/book-1.0.0.xsd"> + <id>cc-xjc-manual</id> + <title>CC-XJC Manual</title> + <chapters> + <chapter> + <id>index</id> + <title>Introduction</title> + <sections> + <section> + <id>index</id> + </section> + </sections> + </chapter> + <chapter> + <id>maven</id> + <title>Maven</title> + <sections> + <section> + <id>maven</id> + </section> + </sections> + </chapter> + <chapter> + <id>license-info</id> + <title>License</title> + <sections> + <section> + <id>license-info</id> + </section> + </sections> + </chapter> + </chapters> +</book> Property changes on: trunk/src/main/books/cc-xjc-manual.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java (rev 0) +++ trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,414 @@ +/* + * 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: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * o 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. + * + * $Id$ + */ +package net.sourceforge.ccxjc; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JConditional; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JFieldVar; +import com.sun.codemodel.JForEach; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.Plugin; +import com.sun.tools.xjc.model.CTypeInfo; +import com.sun.tools.xjc.outline.Aspect; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.EnumOutline; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; +import java.text.MessageFormat; +import java.util.Collection; +import java.util.ResourceBundle; +import java.util.logging.Level; +import org.xml.sax.ErrorHandler; + +/** + * CC-XJC plugin implementation. + * + * @author <a href="mailto:cs...@sc...">Christian Schulte</a> + * @version $Id$ + */ +public final class PluginImpl extends Plugin +{ + + private static final JType[] NO_ARGS = new JType[ 0 ]; + + private boolean success; + + @Override + public String getOptionName() + { + return "copy-constructor"; + } + + @Override + public String getUsage() + { + return "-copy-constructor\t:\tenable generation of copy constructors"; + } + + @Override + public boolean run( final Outline model, final Options options, final ErrorHandler errorHandler ) + { + this.success = true; + + for ( ClassOutline clazz : model.getClasses() ) + { + if ( this.getStandardConstructor( clazz ) == null ) + { + this.log( Level.SEVERE, "couldNotAddStdCtor", new Object[] + { + clazz.implClass.binaryName() + } ); + + this.success = false; + } + + if ( this.getCopyConstructor( clazz ) == null ) + { + this.log( Level.SEVERE, "couldNotAddCopyCtor", new Object[] + { + clazz.implClass.binaryName() + } ); + + this.success = false; + } + } + + return this.success; + } + + private ClassOutline getClassOutline( final Outline outline, final String binaryName ) + { + for ( ClassOutline c : outline.getClasses() ) + { + if ( c.implClass.binaryName().equals( binaryName ) ) + { + return c; + } + } + + return null; + } + + private EnumOutline getEnumOutline( final Outline outline, final String binaryName ) + { + for ( EnumOutline e : outline.getEnums() ) + { + if ( e.clazz.binaryName().equals( binaryName ) ) + { + return e; + } + } + + return null; + } + + private JMethod getPropertyGetter( final FieldOutline f ) + { + final JDefinedClass clazz = f.parent().implClass; + final String name = f.getPropertyInfo().getName( true ); + JMethod getter = clazz.getMethod( "get" + name, NO_ARGS ); + + if ( getter == null ) + { + getter = clazz.getMethod( "is" + name, NO_ARGS ); + } + + return getter; + } + + private boolean isPropertyField( final ClassOutline clazz, final String fieldName ) + { + for ( FieldOutline f : clazz.getDeclaredFields() ) + { + if ( f.getPropertyInfo().getName( false ).equals( fieldName ) ) + { + return true; + } + } + + return false; + } + + private JMethod getStandardConstructor( final ClassOutline clazz ) + { + JMethod ctor = clazz.implClass.getConstructor( NO_ARGS ); + if ( ctor == null ) + { + ctor = this.generateStandardConstructor( clazz ); + } + else + { + this.log( Level.WARNING, "standardCtorExists", new Object[] + { + clazz.implClass.binaryName() + } ); + + } + + return ctor; + } + + private JMethod getCopyConstructor( final ClassOutline clazz ) + { + JMethod ctor = clazz.implClass.getConstructor( new JType[] + { + clazz.implClass + } ); + + if ( ctor == null ) + { + ctor = this.generateCopyConstructor( clazz ); + } + else + { + this.log( Level.WARNING, "copyCtorExists", new Object[] + { + clazz.implClass.binaryName() + } ); + + } + + return ctor; + } + + private JMethod generateStandardConstructor( final ClassOutline clazz ) + { + final JMethod ctor = clazz.implClass.constructor( JMod.PUBLIC ); + ctor.body().invoke( "super" ); + ctor.javadoc().add( "Creates a new {@code " + clazz.implClass.binaryName() + "} instance." ); + return ctor; + } + + private JMethod generateCopyConstructor( final ClassOutline clazz ) + { + final JMethod ctor = clazz.implClass.constructor( JMod.PUBLIC ); + final JVar o = ctor.param( clazz.implClass, "o" ); + + ctor.javadoc().add( "Creates a new {@code " + clazz.implClass.binaryName() + + "} instance by copying a given instance." ); + + ctor.javadoc().addParam( o ).add( "The instance to copy or {@code null}." ); + + if ( clazz.getSuperClass() != null ) + { + ctor.body().invoke( "super" ).arg( o ); + } + else + { + ctor.body().invoke( "super" ); + } + + final JConditional paramNotNull = ctor.body()._if( o.ne( JExpr._null() ) ); + for ( FieldOutline field : clazz.getDeclaredFields() ) + { + this.generateCopyProperty( field, o, paramNotNull._then() ); + } + + for ( JFieldVar field : clazz.implClass.fields().values() ) + { + if ( !this.isPropertyField( clazz, field.name() ) ) + { + if ( !field.type().isPrimitive() && this.isCloneable( field.type() ) ) + { + final JConditional refNotNull = + paramNotNull._then()._if( JExpr.ref( o, field ).ne( JExpr._null() ) ); + + refNotNull._then().assign( JExpr.refthis( field.name() ), + JExpr.cast( field.type(), JExpr.ref( o, field ).invoke( "clone" ) ) ); + + refNotNull._else().assign( JExpr.refthis( field.name() ), JExpr._null() ); + + this.log( Level.WARNING, "clonesReference", new Object[] + { + field.name(), + clazz.implClass.binaryName() + } ); + + } + else + { + paramNotNull._then().assign( JExpr.refthis( field.name() ), JExpr.ref( o, field ) ); + this.log( Level.WARNING, "copiesReference", new Object[] + { + field.name(), + clazz.implClass.binaryName() + } ); + + } + } + } + + return ctor; + } + + private void generateCopyProperty( final FieldOutline field, final JVar o, final JBlock block ) + { + final JMethod getter = this.getPropertyGetter( field ); + + if ( getter != null ) + { + if ( field.getPropertyInfo().isCollection() ) + { + final Collection<? extends CTypeInfo> refTypes = field.getPropertyInfo().ref(); + if ( refTypes != null ) + { + if ( refTypes.size() == 1 ) + { + final ClassOutline ref = this.getClassOutline( + field.parent().parent(), refTypes.iterator().next(). + toType( field.parent().parent(), Aspect.EXPOSED ).binaryName() ); + + if ( ref != null ) + { + final JForEach copyLoop = + block.forEach( ref.implClass, "c", JExpr.invoke( o, getter ) ); + + copyLoop.body().invoke( JExpr.invoke( getter ), "add" ). + arg( JExpr._new( ref.implClass ).arg( copyLoop.var() ) ); + + } + else + { + block.invoke( getter ).invoke( "addAll" ).arg( JExpr.invoke( o, getter ) ); + } + } + else + { + this.log( Level.SEVERE, "multipleTypes", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName(), + refTypes.size() + } ); + + this.success = false; + } + } + else + { + this.log( Level.SEVERE, "noTypes", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName(), + } ); + + this.success = false; + } + } + else + { + final ClassOutline ref = + this.getClassOutline( field.parent().parent(), field.getRawType().binaryName() ); + + if ( ref != null ) + { + final JConditional notnull = block._if( JExpr.invoke( o, getter ).ne( JExpr._null() ) ); + notnull._then().assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), + JExpr._new( ref.implClass ).arg( JExpr.invoke( o, getter ) ) ); + + notnull._else().assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), + JExpr._null() ); + + } + else + { + if ( field.getRawType().isPrimitive() || + this.getEnumOutline( field.parent().parent(), field.getRawType().binaryName() ) != null || + !this.isCloneable( field.getRawType() ) ) + { + block.assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), + JExpr.invoke( o, getter ) ); + + } + else + { + final JConditional notnull = block._if( JExpr.invoke( o, getter ).ne( JExpr._null() ) ); + notnull._then().assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), + JExpr.cast( field.getRawType(), + JExpr.invoke( o, getter ).invoke( "clone" ) ) ); + + notnull._else().assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), + JExpr._null() ); + + } + } + } + } + else + { + this.log( Level.SEVERE, "noGetter", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName(), + } ); + + this.success = false; + } + } + + private boolean isCloneable( final JType type ) + { + try + { + ClassLoader cl = this.getClass().getClassLoader(); + if ( cl == null ) + { + cl = ClassLoader.getSystemClassLoader(); + } + + return Cloneable.class.isAssignableFrom( Class.forName( type.binaryName(), false, cl ) ); + } + catch ( ClassNotFoundException e ) + { + this.log( Level.WARNING, "classNotFound", new Object[] + { + type.binaryName() + } ); + + } + + return false; + } + + private void log( final Level level, final String key, final Object args ) + { + final ResourceBundle bundle = ResourceBundle.getBundle( "net/sourceforge/ccxjc/PluginImpl" ); + System.err.println( '[' + level.toString() + "] " + + new MessageFormat( bundle.getString( key ) ).format( args ) ); + + } + +} Property changes on: trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/src/main/javadoc/net/sourceforge/ccxjc/package.html =================================================================== --- trunk/src/main/javadoc/net/sourceforge/ccxjc/package.html (rev 0) +++ trunk/src/main/javadoc/net/sourceforge/ccxjc/package.html 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,37 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!-- + + 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. + + $Id$ + +--> +<html> + <body> + CC-XJC Plugin classes. + </body> +</html> Property changes on: trunk/src/main/javadoc/net/sourceforge/ccxjc/package.html ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin =================================================================== --- trunk/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin (rev 0) +++ trunk/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1 @@ +net.sourceforge.ccxjc.PluginImpl Property changes on: trunk/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties (rev 0) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,10 @@ +couldNotAddStdCtor=Could not add a public no-arg constructor to class ''{0}''. +couldNotAddCopyCtor=Could not add a copy constructor to class ''{0}''. +multipleTypes=Collection property ''{0}'' of class ''{1}'' references multiple types ({2,number}). +noTypes=Collection property ''{0}'' of class ''{1}'' references no types. +noGetter=Getter for property ''{0}'' of class ''{1}'' not found. +classNotFound=Class ''{0}'' not found. +standardCtorExists=Skipping class ''{0}''. The class already declares a public no-arg constructor. +copyCtorExists=Skipping class ''{0}''. The class already declares a copy constructor. +copiesReference=Field ''{0}'' of class ''{1}'' has no properties. Copies object reference. +clonesReference=Cloneable field ''{0}'' of class ''{1}'' has no properties. Clones object reference. Property changes on: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties (rev 0) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,10 @@ +couldNotAddStdCtor=Konnte keinen \u00F6ffentlichen Standard-Konstruktor zur Klasse ''{0}'' hinzuf\u00FCgen. +couldNotAddCopyCtor=Konnte keinen Kopier-Konstruktor zur Klasse ''{0}'' hinzuf\u00FCgen. +multipleTypes=Die ''{0}'' Eigenschaft der Klasse ''{1}'' referenziert mehrere Typen ({2,number}). +noTypes=Die ''{0}'' Eigenschaft der Klasse ''{1}'' referenziert keine Typen. +noGetter=Accessor-Methode f\u00FCr ''{0}'' Eigenschaft der Klasse ''{1}'' nicht gefunden. +classNotFound=Klasse ''{0}'' nicht gefunden. +standardCtorExists=Klasse ''{0}'' besitzt bereits einen \u00F6ffentlichen Standard-Konstruktor. Keinen Quelltext erzeugt. +copyCtorExists=Klasse ''{0}'' besitzt bereits einen Kopier-Konstruktor. Keinen Quelltext erzeugt. +copiesReference=Feld ''{0}'' der Klasse ''{1}'' verf\u00FCgt \u00FCber keine Eigenschaften. Kopiert Objekt-Referenz. +clonesReference=Klonbares Feld ''{0}'' der Klasse ''{1}'' verf\u00FCgt \u00FCber keine Eigenschaften. Klont Objekt-Referenz. Property changes on: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties (rev 0) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,10 @@ +couldNotAddStdCtor=Could not add a public no-arg constructor to class ''{0}''. +couldNotAddCopyCtor=Could not add a copy constructor to class ''{0}''. +multipleTypes=Collection property ''{0}'' of class ''{1}'' references multiple types ({2,number}). +noTypes=Collection property ''{0}'' of class ''{1}'' references no types. +noGetter=Getter for property ''{0}'' of class ''{1}'' not found. +classNotFound=Class ''{0}'' not found. +standardCtorExists=Skipping class ''{0}''. The class already declares a public no-arg constructor. +copyCtorExists=Skipping class ''{0}''. The class already declares a copy constructor. +copiesReference=Field ''{0}'' of class ''{1}'' has no properties. Copies object reference. +clonesReference=Cloneable field ''{0}'' of class ''{1}'' has no properties. Clones object reference. Property changes on: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt (rev 0) +++ trunk/src/site/apt/index.apt 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,50 @@ + ----- +CC-XJC + ----- +Christian Schulte + ----- +May 2009 + ----- + +~~ 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. +~~ +~~ $Id$ +~~ + +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. That option takes no + parameters. + +Support + + Development of CC-XJC is driven by the community. Please file any issues with + the {{{https://apps.sourceforge.net/mantisbt/ccxjc/}MantisBT}} bugracker or + subscribe to the {{{http://ccxjc.sourceforge.net/mail-lists.html}ccxjc-users}} + mailing list for discussing issues or asking questions. Property changes on: trunk/src/site/apt/index.apt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/src/site/apt/license-info.apt =================================================================== --- trunk/src/site/apt/license-info.apt (rev 0) +++ trunk/src/site/apt/license-info.apt 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,64 @@ + ----- +CC-XJC + ----- +Christian Schulte + ----- +May 2009 + ----- + +~~ 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. +~~ +~~ $Id$ +~~ + +The CC-XJC 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. Property changes on: trunk/src/site/apt/license-info.apt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/src/site/apt/maven.apt =================================================================== --- trunk/src/site/apt/maven.apt (rev 0) +++ trunk/src/site/apt/maven.apt 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,148 @@ + ----- +CC-XJC + ----- +Christian Schulte + ----- +May 2009 + ----- + +~~ 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. +~~ +~~ $Id$ +~~ + +Maven Information + + 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.xml. + +--- + + <repository> + <id>ccxjc.sourceforge.net</id> + <url>http://ccxjc.sourceforge.net/maven2/releases</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + +--- + +Example + + 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-1</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</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>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> + <url>http://download.java.net/maven/2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> +</repositories> + +<pluginRepositories> + <pluginRepository> + <id>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> + <url>http://download.java.net/maven/2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> +</pluginRepositories> + +--- Property changes on: trunk/src/site/apt/maven.apt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml (rev 0) +++ trunk/src/site/site.xml 2009-05-02 01:37:12 UTC (rev 2) @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<project name="JPA-XJC"> + <skin> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-classic-skin</artifactId> + <version>1.0</version> + </skin> + <body> + <head> + <meta name="keywords" content="xjc, jaxb, plugin, schema, java, xml, xsd, constructor, copy, copy-constructor, ctor, copy-ctor,"/> + </head> + + <menu name="CC-XJC"> + <item name="About" href="index.html"/> + <item name="Maven Information" href="maven.html"/> + </menu> + + <menu name="Sourceforge"> + <item name="Project Summary" href="https://sourceforge.net/projects/ccxjc/"/> + <item name="Download" href="https://sourceforge.net/project/showfiles.php?group_id=260900"/> + </menu> + + <menu ref="reports" /> + + </body> +</project> Property changes on: trunk/src/site/site.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-05-02 03:45:48
|
Revision: 9 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=9&view=rev Author: schulte2005 Date: 2009-05-02 03:45:46 +0000 (Sat, 02 May 2009) Log Message: ----------- o Added changes report. Modified Paths: -------------- trunk/pom.xml Added Paths: ----------- trunk/src/main/changes/ trunk/src/main/changes/changes.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-05-02 02:57:11 UTC (rev 8) +++ trunk/pom.xml 2009-05-02 03:45:46 UTC (rev 9) @@ -1,3 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>net.sourceforge.ccxjc</groupId> @@ -267,6 +299,7 @@ </reports> </reportSet> </reportSets> + <xmlPath>src/main/changes/changes.xml</xmlPath> </configuration> </plugin> </plugins> Added: trunk/src/main/changes/changes.xml =================================================================== --- trunk/src/main/changes/changes.xml (rev 0) +++ trunk/src/main/changes/changes.xml 2009-05-02 03:45:46 UTC (rev 9) @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<document xmlns="http://maven.apache.org/changes/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + <properties> + <title>Changelog</title> + <author email="sch...@us...">Christian Schulte</author> + </properties> + <body> + <!-- ******************************************************************* --> + <release version="1.0-beta-1" date="2009-05-02" + description="First release."/> + + <!-- ******************************************************************* --> + <release version="1.0-beta-2" date="2009-05-03" + description="Bugfix release."> + + <action dev="schulte2005" type="fix" issue="0000001" system="MantisBT"> + Incorrect code generated for collection valued properties referencing + non schema derived classes. + </action> + </release> + </body> +</document> Property changes on: trunk/src/main/changes/changes.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-05-03 01:59:43
|
Revision: 20 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=20&view=rev Author: schulte2005 Date: 2009-05-03 01:59:32 +0000 (Sun, 03 May 2009) Log Message: ----------- o Updated to support cloneable classes whose clone() method declare to throw a CloneNotSupportedException. Modified Paths: -------------- trunk/pom.xml trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-05-02 07:18:19 UTC (rev 19) +++ trunk/pom.xml 2009-05-03 01:59:32 UTC (rev 20) @@ -397,7 +397,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> - <version>1.3</version> <dependencies> <dependency> <groupId>org.apache.ant</groupId> Modified: trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-05-02 07:18:19 UTC (rev 19) +++ trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-05-03 01:59:32 UTC (rev 20) @@ -30,6 +30,7 @@ package net.sourceforge.ccxjc; import com.sun.codemodel.JBlock; +import com.sun.codemodel.JCatchBlock; import com.sun.codemodel.JConditional; import com.sun.codemodel.JDefinedClass; import com.sun.codemodel.JExpr; @@ -37,6 +38,7 @@ import com.sun.codemodel.JForEach; import com.sun.codemodel.JMethod; import com.sun.codemodel.JMod; +import com.sun.codemodel.JTryBlock; import com.sun.codemodel.JType; import com.sun.codemodel.JVar; import com.sun.tools.xjc.Options; @@ -47,6 +49,7 @@ import com.sun.tools.xjc.outline.EnumOutline; import com.sun.tools.xjc.outline.FieldOutline; import com.sun.tools.xjc.outline.Outline; +import java.lang.reflect.Method; import java.text.MessageFormat; import java.util.Collection; import java.util.ResourceBundle; @@ -64,6 +67,8 @@ private static final JType[] NO_ARGS = new JType[ 0 ]; + private static final Class[] NO_PARAMS = new Class[ 0 ]; + private boolean success; @Override @@ -243,9 +248,23 @@ { if ( !field.type().isPrimitive() && this.isCloneable( field.type() ) ) { - final JConditional refNotNull = - paramNotNull._then()._if( JExpr.ref( o, field ).ne( JExpr._null() ) ); + JConditional refNotNull = null; + if ( this.isThrowingCloneNotSupportedException( field.type() ) ) + { + final JTryBlock tryClone = paramNotNull._then()._try(); + final JCatchBlock cloneNotSupported = tryClone._catch( clazz.parent().getCodeModel().ref( + CloneNotSupportedException.class ) ); + cloneNotSupported.body()._throw( JExpr._new( clazz.parent().getCodeModel().ref( + AssertionError.class ) ).arg( cloneNotSupported.param( "e" ) ) ); + + refNotNull = tryClone.body()._if( JExpr.ref( o, field ).ne( JExpr._null() ) ); + } + else + { + refNotNull = paramNotNull._then()._if( JExpr.ref( o, field ).ne( JExpr._null() ) ); + } + refNotNull._then().assign( JExpr.refthis( field.name() ), JExpr.cast( field.type(), JExpr.ref( o, field ).invoke( "clone" ) ) ); @@ -355,7 +374,24 @@ } else { - final JConditional notnull = block._if( JExpr.invoke( o, getter ).ne( JExpr._null() ) ); + JConditional notnull = null; + if ( this.isThrowingCloneNotSupportedException( field.getRawType() ) ) + { + final JTryBlock tryCloneable = block._try(); + final JCatchBlock catchCloneNotSupported = + tryCloneable._catch( field.parent().parent().getCodeModel().ref( + CloneNotSupportedException.class ) ); + + catchCloneNotSupported.body()._throw( JExpr._new( field.parent().parent().getCodeModel(). + _ref( AssertionError.class ) ).arg( catchCloneNotSupported.param( "e" ) ) ); + + notnull = tryCloneable.body()._if( JExpr.invoke( o, getter ).ne( JExpr._null() ) ); + } + else + { + notnull = block._if( JExpr.invoke( o, getter ).ne( JExpr._null() ) ); + } + notnull._then().assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), JExpr.cast( field.getRawType(), JExpr.invoke( o, getter ).invoke( "clone" ) ) ); @@ -379,23 +415,62 @@ } } + private ClassLoader getClassLoader() + { + ClassLoader cl = this.getClass().getClassLoader(); + if ( cl == null ) + { + cl = ClassLoader.getSystemClassLoader(); + } + + return cl; + } + private boolean isCloneable( final JType type ) { try { - ClassLoader cl = this.getClass().getClassLoader(); - if ( cl == null ) + return Cloneable.class.isAssignableFrom( Class.forName( type.binaryName(), false, this.getClassLoader() ) ); + } + catch ( ClassNotFoundException e ) + { + this.log( Level.WARNING, "classNotFound", new Object[] + { + e.getMessage() + } ); + + } + + return false; + } + + private boolean isThrowingCloneNotSupportedException( final JType type ) + { + try + { + final Class clazz = Class.forName( type.binaryName(), false, this.getClassLoader() ); + final Method clone = clazz.getMethod( "clone", NO_PARAMS ); + for ( Class e : clone.getExceptionTypes() ) { - cl = ClassLoader.getSystemClassLoader(); + if ( CloneNotSupportedException.class.isAssignableFrom( e ) ) + { + return true; + } } + } + catch ( NoSuchMethodException e ) + { + this.log( Level.WARNING, "methodNotFound", new Object[] + { + e.getMessage() + } ); - return Cloneable.class.isAssignableFrom( Class.forName( type.binaryName(), false, cl ) ); } catch ( ClassNotFoundException e ) { this.log( Level.WARNING, "classNotFound", new Object[] { - type.binaryName() + e.getMessage() } ); } Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-05-02 07:18:19 UTC (rev 19) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-05-03 01:59:32 UTC (rev 20) @@ -3,9 +3,10 @@ multipleTypes=Collection property ''{0}'' of class ''{1}'' references multiple types ({2,number}). noTypes=Collection property ''{0}'' of class ''{1}'' references no types. noGetter=Getter for property ''{0}'' of class ''{1}'' not found. -classNotFound=Class ''{0}'' not found. +classNotFound=Class not found: ''{0}'' standardCtorExists=Skipping class ''{0}''. The class already declares a public no-arg constructor. copyCtorExists=Skipping class ''{0}''. The class already declares a copy constructor. copiesReference=Field ''{0}'' of class ''{1}'' has no properties. Copies object reference. clonesReference=Cloneable field ''{0}'' of class ''{1}'' has no properties. Clones object reference. usage=-copy-constructor\t:\tenable generation of copy constructors. +methodNotFound=Method not found: ''{0}'' Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-05-02 07:18:19 UTC (rev 19) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-05-03 01:59:32 UTC (rev 20) @@ -3,9 +3,10 @@ multipleTypes=Die ''{0}'' Eigenschaft der Klasse ''{1}'' referenziert mehrere Typen ({2,number}). noTypes=Die ''{0}'' Eigenschaft der Klasse ''{1}'' referenziert keine Typen. noGetter=Accessor-Methode f\u00FCr ''{0}'' Eigenschaft der Klasse ''{1}'' nicht gefunden. -classNotFound=Klasse ''{0}'' nicht gefunden. +classNotFound=Klasse nicht gefunden: ''{0}'' standardCtorExists=Klasse ''{0}'' besitzt bereits einen \u00F6ffentlichen Standard-Konstruktor. Keinen Quelltext erzeugt. copyCtorExists=Klasse ''{0}'' besitzt bereits einen Kopier-Konstruktor. Keinen Quelltext erzeugt. copiesReference=Feld ''{0}'' der Klasse ''{1}'' verf\u00FCgt \u00FCber keine Eigenschaften. Kopiert Objekt-Referenz. clonesReference=Klonbares Feld ''{0}'' der Klasse ''{1}'' verf\u00FCgt \u00FCber keine Eigenschaften. Klont Objekt-Referenz. usage=-copy-constructor\t:\taktiviert die Generierung von Kopier-Konstruktoren. +methodNotFound=Methode nicht gefunden: ''{0}'' Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-05-02 07:18:19 UTC (rev 19) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-05-03 01:59:32 UTC (rev 20) @@ -3,9 +3,10 @@ multipleTypes=Collection property ''{0}'' of class ''{1}'' references multiple types ({2,number}). noTypes=Collection property ''{0}'' of class ''{1}'' references no types. noGetter=Getter for property ''{0}'' of class ''{1}'' not found. -classNotFound=Class ''{0}'' not found. +classNotFound=Class not found: ''{0}'' standardCtorExists=Skipping class ''{0}''. The class already declares a public no-arg constructor. copyCtorExists=Skipping class ''{0}''. The class already declares a copy constructor. copiesReference=Field ''{0}'' of class ''{1}'' has no properties. Copies object reference. clonesReference=Cloneable field ''{0}'' of class ''{1}'' has no properties. Clones object reference. usage=-copy-constructor\t:\tenable generation of copy constructors. +methodNotFound=Method not found: ''{0}'' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-05-04 15:44:13
|
Revision: 21 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=21&view=rev Author: schulte2005 Date: 2009-05-04 15:44:02 +0000 (Mon, 04 May 2009) Log Message: ----------- o Added support for multi-valued collection properties. o Updated to add a clone method and the the Cloneable interface to all schema derived classes. Modified Paths: -------------- trunk/pom.xml trunk/src/main/changes/changes.xml trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-05-03 01:59:32 UTC (rev 20) +++ trunk/pom.xml 2009-05-04 15:44:02 UTC (rev 21) @@ -89,6 +89,7 @@ <resources> <resource> <directory>src/main/resources</directory> + <filtering>true</filtering> </resource> <resource> <directory>${basedir}</directory> Modified: trunk/src/main/changes/changes.xml =================================================================== --- trunk/src/main/changes/changes.xml 2009-05-03 01:59:32 UTC (rev 20) +++ trunk/src/main/changes/changes.xml 2009-05-04 15:44:02 UTC (rev 21) @@ -39,17 +39,23 @@ </properties> <body> <!-- ******************************************************************* --> - <release version="1.0-beta-1" date="2009-05-02" - description="First release."/> + <release version="1.0-beta-1" date="2009-05-02"/> <!-- ******************************************************************* --> - <release version="1.0-beta-2" date="2009-05-03" - description="Bugfix release."> - + <release version="1.0-beta-2" date="2009-05-03"> <action dev="schulte2005" type="fix" issue="0000001" system="MantisBT"> Incorrect code generated for collection valued properties referencing non schema derived classes. </action> </release> + + <!-- ******************************************************************* --> + <release version="1.0-beta-3" date="2009-05-04"> + <action dev="schulte2005" type="update"> + Added support for multi-valued collection properties. Updated to add + a clone method and the the Cloneable interface to all schema derived + classes. + </action> + </release> </body> </document> Modified: trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-05-03 01:59:32 UTC (rev 20) +++ trunk/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-05-04 15:44:02 UTC (rev 21) @@ -31,11 +31,12 @@ import com.sun.codemodel.JBlock; import com.sun.codemodel.JCatchBlock; +import com.sun.codemodel.JClass; import com.sun.codemodel.JConditional; import com.sun.codemodel.JDefinedClass; import com.sun.codemodel.JExpr; import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JForEach; +import com.sun.codemodel.JForLoop; import com.sun.codemodel.JMethod; import com.sun.codemodel.JMod; import com.sun.codemodel.JTryBlock; @@ -51,7 +52,12 @@ import com.sun.tools.xjc.outline.Outline; import java.lang.reflect.Method; import java.text.MessageFormat; -import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; import java.util.ResourceBundle; import java.util.logging.Level; import org.xml.sax.ErrorHandler; @@ -69,8 +75,12 @@ private static final Class[] NO_PARAMS = new Class[ 0 ]; + private static final String MESSAGE_PREFIX = "CC-XJC"; + private boolean success; + private Options options; + @Override public String getOptionName() { @@ -87,30 +97,44 @@ public boolean run( final Outline model, final Options options, final ErrorHandler errorHandler ) { this.success = true; + this.options = options; + this.log( Level.INFO, "title", null ); + for ( ClassOutline clazz : model.getClasses() ) { if ( this.getStandardConstructor( clazz ) == null ) { - this.log( Level.SEVERE, "couldNotAddStdCtor", new Object[] + this.log( Level.WARNING, "couldNotAddStdCtor", new Object[] { clazz.implClass.binaryName() } ); - this.success = false; } if ( this.getCopyConstructor( clazz ) == null ) { - this.log( Level.SEVERE, "couldNotAddCopyCtor", new Object[] + this.log( Level.WARNING, "couldNotAddCopyCtor", new Object[] { clazz.implClass.binaryName() } ); - this.success = false; } } + for ( ClassOutline clazz : model.getClasses() ) + { + if ( this.getCloneMethod( clazz ) == null ) + { + this.log( Level.WARNING, "couldNotAddMethod", new Object[] + { + "clone", + clazz.implClass.binaryName() + } ); + + } + } + return this.success; } @@ -140,6 +164,54 @@ return null; } + private JClass getSupertype( final List<JClass> superTypes, final JClass clazz ) + { + JClass superType = null; + + if ( clazz._extends() != null ) + { + superType = this.getSupertype( superTypes, clazz._extends() ); + } + + if ( superType == null ) + { + for ( JClass c : superTypes ) + { + if ( c.binaryName().equals( clazz.binaryName() ) ) + { + superType = clazz; + break; + } + } + } + + return superType; + } + + private ClassOutline getSuperclass( final List<ClassOutline> superClasses, final ClassOutline clazz ) + { + ClassOutline superClass = null; + + if ( clazz.getSuperClass() != null ) + { + superClass = this.getSuperclass( superClasses, clazz.getSuperClass() ); + } + + if ( superClass == null ) + { + for ( ClassOutline c : superClasses ) + { + if ( c.implClass.binaryName().equals( clazz.implClass.binaryName() ) ) + { + superClass = clazz; + break; + } + } + } + + return superClass; + } + private JMethod getPropertyGetter( final FieldOutline f ) { final JDefinedClass clazz = f.parent().implClass; @@ -167,6 +239,25 @@ return false; } + private JMethod getCloneMethod( final ClassOutline clazz ) + { + JMethod clone = clazz.implClass.getMethod( "clone", NO_ARGS ); + if ( clone == null ) + { + clone = this.generateCloneMethod( clazz ); + } + else + { + this.log( Level.WARNING, "methodExists", new Object[] + { + "clone", clazz.implClass.binaryName() + } ); + + } + + return clone; + } + private JMethod getStandardConstructor( final ClassOutline clazz ) { JMethod ctor = clazz.implClass.getConstructor( NO_ARGS ); @@ -209,9 +300,39 @@ return ctor; } + private JMethod generateCloneMethod( final ClassOutline clazz ) + { + JMethod cloneMethod = null; + + if ( clazz.implClass.isAbstract() ) + { + cloneMethod = clazz.implClass.method( JMod.ABSTRACT | JMod.PUBLIC, clazz.parent().getCodeModel(). + ref( Object.class ), "clone" ); + + } + else + { + cloneMethod = clazz.implClass.method( JMod.PUBLIC, clazz.parent().getCodeModel(). + ref( Object.class ), "clone" ); + + cloneMethod.body().directStatement( " // " + this.getMessage( "title", null ) ); + cloneMethod.body()._return( JExpr._new( clazz.implClass ).arg( JExpr._this() ) ); + } + + cloneMethod.annotate( Override.class ); + clazz.implClass._implements( clazz.parent().getCodeModel().ref( Cloneable.class ) ); + + cloneMethod.javadoc().append( "Creates and returns a copy of this object.\n" ); + + cloneMethod.javadoc().addReturn().append( "A clone of this instance." ); + + return cloneMethod; + } + private JMethod generateStandardConstructor( final ClassOutline clazz ) { final JMethod ctor = clazz.implClass.constructor( JMod.PUBLIC ); + ctor.body().directStatement( " // " + this.getMessage( "title", null ) ); ctor.body().invoke( "super" ); ctor.javadoc().add( "Creates a new {@code " + clazz.implClass.fullName() + "} instance." ); return ctor; @@ -227,6 +348,8 @@ ctor.javadoc().addParam( o ).add( "The instance to copy or {@code null}." ); + ctor.body().directStatement( " // " + this.getMessage( "title", null ) ); + if ( clazz.getSuperClass() != null ) { ctor.body().invoke( "super" ).arg( o ); @@ -246,47 +369,7 @@ { if ( !this.isPropertyField( clazz, field.name() ) ) { - if ( !field.type().isPrimitive() && this.isCloneable( field.type() ) ) - { - JConditional refNotNull = null; - if ( this.isThrowingCloneNotSupportedException( field.type() ) ) - { - final JTryBlock tryClone = paramNotNull._then()._try(); - final JCatchBlock cloneNotSupported = tryClone._catch( clazz.parent().getCodeModel().ref( - CloneNotSupportedException.class ) ); - - cloneNotSupported.body()._throw( JExpr._new( clazz.parent().getCodeModel().ref( - AssertionError.class ) ).arg( cloneNotSupported.param( "e" ) ) ); - - refNotNull = tryClone.body()._if( JExpr.ref( o, field ).ne( JExpr._null() ) ); - } - else - { - refNotNull = paramNotNull._then()._if( JExpr.ref( o, field ).ne( JExpr._null() ) ); - } - - refNotNull._then().assign( JExpr.refthis( field.name() ), - JExpr.cast( field.type(), JExpr.ref( o, field ).invoke( "clone" ) ) ); - - refNotNull._else().assign( JExpr.refthis( field.name() ), JExpr._null() ); - - this.log( Level.WARNING, "clonesReference", new Object[] - { - field.name(), - clazz.implClass.binaryName() - } ); - - } - else - { - paramNotNull._then().assign( JExpr.refthis( field.name() ), JExpr.ref( o, field ) ); - this.log( Level.WARNING, "copiesReference", new Object[] - { - field.name(), - clazz.implClass.binaryName() - } ); - - } + this.generateCopyField( clazz, field, o, paramNotNull._then() ); } } @@ -296,49 +379,167 @@ private void generateCopyProperty( final FieldOutline field, final JVar o, final JBlock block ) { final JMethod getter = this.getPropertyGetter( field ); + final JType object = field.parent().parent().getCodeModel().ref( Object.class ); + final JClass assertionErrorType = field.parent().parent().getCodeModel().ref( AssertionError.class ); if ( getter != null ) { if ( field.getPropertyInfo().isCollection() ) { - final Collection<? extends CTypeInfo> refTypes = field.getPropertyInfo().ref(); - if ( refTypes != null ) + block.directStatement( "// Property '" + field.getPropertyInfo().getName( true ) + "'." ); + final List<CTypeInfo> refTypes = new LinkedList<CTypeInfo>( + field.getPropertyInfo().ref() != null ? field.getPropertyInfo().ref() : Collections.EMPTY_LIST ); + + if ( !refTypes.isEmpty() ) { - if ( refTypes.size() == 1 ) + final List<JClass> allTypes = new LinkedList<JClass>(); + for ( CTypeInfo t : refTypes ) { - final ClassOutline ref = this.getClassOutline( - field.parent().parent(), refTypes.iterator().next(). - toType( field.parent().parent(), Aspect.EXPOSED ).binaryName() ); + String typeName = t.toType( field.parent().parent(), Aspect.EXPOSED ).binaryName(); + int idx = typeName.indexOf( '<' ); + if ( idx != -1 ) + { + typeName = typeName.substring( 0, idx ); + } + + final JClass javaType = field.parent().parent().getCodeModel().ref( typeName ); + if ( !allTypes.contains( javaType ) ) + { + allTypes.add( javaType ); + } + } + + final JForLoop copyLoop = block._for(); + final JVar it = copyLoop.init( field.parent().parent().getCodeModel().ref( Iterator.class ), + "it", JExpr.invoke( o, getter ).invoke( "iterator" ) ); + + copyLoop.test( JExpr.invoke( it, "hasNext" ) ); + + final JVar next = copyLoop.body().decl( object, "next", JExpr.invoke( it, "next" ) ); + + final List<ClassOutline> allClasses = new LinkedList<ClassOutline>(); + for ( Iterator<CTypeInfo> t = refTypes.iterator(); t.hasNext(); ) + { + final JType copy = t.next().toType( field.parent().parent(), Aspect.EXPOSED ); + final ClassOutline ref = this.getClassOutline( field.parent().parent(), copy.binaryName() ); + if ( ref != null ) { - final JForEach copyLoop = - block.forEach( ref.implClass, "c", JExpr.invoke( o, getter ) ); + if ( !allClasses.contains( ref ) ) + { + allClasses.add( ref ); + } - copyLoop.body().invoke( JExpr.invoke( getter ), "add" ). - arg( JExpr._new( ref.implClass ).arg( copyLoop.var() ) ); + t.remove(); + } + } + final List<ClassOutline> superClasses = new LinkedList<ClassOutline>(); + for ( ClassOutline c : allClasses ) + { + final ClassOutline superClass = this.getSuperclass( allClasses, c ); + if ( !superClasses.contains( superClass ) ) + { + superClasses.add( superClass ); } + } + + Collections.sort( superClasses, new ClassOutlineComparator() ); + + for ( ClassOutline refClass : superClasses ) + { + copyLoop.body().directStatement( "// Cloneable reference '" + + refClass.implClass.binaryName() + "'." ); + + final JConditional ifInstance = + copyLoop.body()._if( next._instanceof( refClass.implClass ) ); + + ifInstance._then().invoke( JExpr.invoke( getter ), "add" ). + arg( JExpr.cast( refClass.implClass, JExpr.invoke( + JExpr.cast( refClass.implClass, JExpr.ref( "next" ) ), "clone" ) ) ); + + ifInstance._then()._continue(); + } + + final List<JClass> superTypes = new LinkedList<JClass>(); + + for ( CTypeInfo type : refTypes ) + { + String typeName = type.toType( field.parent().parent(), Aspect.EXPOSED ).binaryName(); + int idx = typeName.indexOf( '<' ); + + if ( idx != -1 ) + { + typeName = typeName.substring( 0, idx ); + } + + final JClass javaType = field.parent().parent().getCodeModel().ref( typeName ); + final JClass superType = this.getSupertype( allTypes, javaType ); + if ( !superTypes.contains( superType ) ) + { + superTypes.add( superType ); + } + } + + Collections.sort( superTypes, new JClassComparator() ); + + for ( Iterator<JClass> t = superTypes.iterator(); t.hasNext(); ) + { + final JType refType = t.next(); + final JConditional ifInstance = copyLoop.body()._if( next._instanceof( refType ) ); + if ( !this.isCloneable( refType ) ) + { + ifInstance._then().directStatement( "// Immutable type '" + refType.binaryName() + "'." ); + ifInstance._then().invoke( JExpr.invoke( getter ), "add" ). + arg( JExpr.cast( refType, next ) ); + + ifInstance._then()._continue(); + } else { - block.invoke( JExpr.invoke( getter ), "addAll" ).arg( JExpr.invoke( o, getter ) ); + ifInstance._then().directStatement( "// Cloneable type '" + refType.binaryName() + "'." ); + + JBlock cloneBlock = ifInstance._then(); + if ( this.isThrowingCloneNotSupportedException( refType ) ) + { + final JTryBlock tryCloneable = cloneBlock._try(); + final JCatchBlock catchCloneNotSupported = + tryCloneable._catch( field.parent().parent().getCodeModel().ref( + CloneNotSupportedException.class ) ); + + catchCloneNotSupported.body()._throw( JExpr._new( + field.parent().parent().getCodeModel()._ref( AssertionError.class ) ). + arg( catchCloneNotSupported.param( "e" ) ) ); + + cloneBlock = tryCloneable.body(); + } + + cloneBlock.invoke( JExpr.invoke( getter ), "add" ).arg( + JExpr.cast( refType, JExpr.invoke( JExpr.cast( refType, next ), "clone" ) ) ); + + t.remove(); } } - else + + copyLoop.body()._throw( JExpr._new( assertionErrorType ).arg( JExpr.lit( + "Unexpected instance '" ).plus( next ).plus( JExpr.lit( + "' for property '" + field.getPropertyInfo().getName( true ) + + "' of class '" + field.parent().implClass.binaryName() + "'." ) ) ) ); + + if ( !superTypes.isEmpty() ) { - this.log( Level.SEVERE, "multipleTypes", new Object[] + this.log( Level.WARNING, "cannotCopyProperty", new Object[] { field.getPropertyInfo().getName( true ), - field.parent().implClass.binaryName(), - refTypes.size() + field.parent().implClass.binaryName() } ); - this.success = false; } } else { - this.log( Level.SEVERE, "noTypes", new Object[] + this.log( Level.SEVERE, "typesNotFound", new Object[] { field.getPropertyInfo().getName( true ), field.parent().implClass.binaryName(), @@ -354,9 +555,13 @@ if ( ref != null ) { + block.directStatement( "// Property '" + field.getPropertyInfo().getName( true ) + "'." ); final JConditional notnull = block._if( JExpr.invoke( o, getter ).ne( JExpr._null() ) ); + notnull._then().directStatement( "// Cloneable reference '" + + ref.implClass.binaryName() + "'." ); + notnull._then().assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), - JExpr._new( ref.implClass ).arg( JExpr.invoke( o, getter ) ) ); + JExpr.cast( ref.implClass, JExpr.invoke( o, getter ).invoke( "clone" ) ) ); notnull._else().assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), JExpr._null() ); @@ -368,12 +573,18 @@ this.getEnumOutline( field.parent().parent(), field.getRawType().binaryName() ) != null || !this.isCloneable( field.getRawType() ) ) { + block.directStatement( "// Immutable property '" + field.getPropertyInfo().getName( true ) + + "' of type '" + field.getRawType().binaryName() + "'." ); + block.assign( JExpr.refthis( field.getPropertyInfo().getName( false ) ), JExpr.invoke( o, getter ) ); } else { + block.directStatement( "// Cloneable property '" + field.getPropertyInfo().getName( true ) + + "' of type '" + field.getRawType().binaryName() + "'." ); + JConditional notnull = null; if ( this.isThrowingCloneNotSupportedException( field.getRawType() ) ) { @@ -405,7 +616,7 @@ } else { - this.log( Level.SEVERE, "noGetter", new Object[] + this.log( Level.SEVERE, "getterNotFound", new Object[] { field.getPropertyInfo().getName( true ), field.parent().implClass.binaryName(), @@ -415,6 +626,47 @@ } } + private void generateCopyField( final ClassOutline clazz, final JFieldVar field, final JVar o, final JBlock block ) + { + if ( !field.type().isPrimitive() && this.isCloneable( field.type() ) ) + { + block.directStatement( "// Cloneable field '" + field.name() + "'." ); + + JConditional refNotNull = null; + if ( this.isThrowingCloneNotSupportedException( field.type() ) ) + { + final JTryBlock tryClone = block._try(); + final JCatchBlock cloneNotSupported = tryClone._catch( clazz.parent().getCodeModel().ref( + CloneNotSupportedException.class ) ); + + cloneNotSupported.body()._throw( JExpr._new( clazz.parent().getCodeModel().ref( + AssertionError.class ) ).arg( cloneNotSupported.param( "e" ) ) ); + + refNotNull = tryClone.body()._if( JExpr.ref( o, field ).ne( JExpr._null() ) ); + } + else + { + refNotNull = block._if( JExpr.ref( o, field ).ne( JExpr._null() ) ); + } + + refNotNull._then().assign( JExpr.refthis( field.name() ), + JExpr.cast( field.type(), JExpr.ref( o, field ).invoke( "clone" ) ) ); + + refNotNull._else().assign( JExpr.refthis( field.name() ), JExpr._null() ); + } + else + { + block.directStatement( "// Immutable field '" + field.name() + "'." ); + block.assign( JExpr.refthis( field.name() ), JExpr.ref( o, field ) ); + this.log( Level.WARNING, "cannotCopyField", new Object[] + { + field.name(), + clazz.implClass.binaryName() + } ); + + } + } + private ClassLoader getClassLoader() { ClassLoader cl = this.getClass().getClassLoader(); @@ -486,7 +738,90 @@ private void log( final Level level, final String key, final Object args ) { - System.err.println( '[' + level.toString() + "] " + this.getMessage( key, args ) ); + final StringBuffer b = new StringBuffer().append( "[" ).append( MESSAGE_PREFIX ).append( "] [" ). + append( level ).append( "] " ).append( this.getMessage( key, args ) ); + + if ( this.options != null && !this.options.quiet ) + { + final int l = + this.options != null && this.options.debugMode ? Level.ALL.intValue() : Level.INFO.intValue(); + + if ( level.intValue() >= l ) + { + if ( level.intValue() <= Level.INFO.intValue() ) + { + System.out.println( b.toString() ); + } + else + { + System.err.println( b.toString() ); + } + } + } } + private void addCloneMethodComment( final Map<ClassOutline, List<FieldOutline>> map, final ClassOutline clazz, + final FieldOutline field ) + { + List<FieldOutline> report = map.get( clazz ); + if ( report == null ) + { + report = new LinkedList<FieldOutline>(); + map.put( clazz, report ); + } + + if ( !report.contains( field ) ) + { + report.add( field ); + } + } + } + +class JClassComparator implements Comparator<JClass> +{ + + private int recurse( final JClass o1, final JClass o2, final int hierarchy ) + { + if ( o1.binaryName().equals( o2.binaryName() ) ) + { + return 0 - hierarchy; + } + if ( o2._extends() != null ) + { + return this.recurse( o1, o2._extends(), hierarchy + 1 ); + } + + return 0; + } + + public int compare( final JClass o1, final JClass o2 ) + { + return this.recurse( o1, o2, 0 ); + } + +} + +class ClassOutlineComparator implements Comparator<ClassOutline> +{ + + private int recurse( final ClassOutline o1, final ClassOutline o2, final int hierarchy ) + { + if ( o1.implClass.binaryName().equals( o2.implClass.binaryName() ) ) + { + return 0 - hierarchy; + } + if ( o2.getSuperClass() != null ) + { + return this.recurse( o1, o2.getSuperClass(), hierarchy + 1 ); + } + + return 0; + } + + public int compare( final ClassOutline o1, final ClassOutline o2 ) + { + return this.recurse( o1, o2, 0 ); + } + +} Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-05-03 01:59:32 UTC (rev 20) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-05-04 15:44:02 UTC (rev 21) @@ -1,12 +1,14 @@ couldNotAddStdCtor=Could not add a public no-arg constructor to class ''{0}''. couldNotAddCopyCtor=Could not add a copy constructor to class ''{0}''. -multipleTypes=Collection property ''{0}'' of class ''{1}'' references multiple types ({2,number}). -noTypes=Collection property ''{0}'' of class ''{1}'' references no types. -noGetter=Getter for property ''{0}'' of class ''{1}'' not found. +typesNotFound=Collection property ''{0}'' of class ''{1}'' references no types. +getterNotNound=Getter for property ''{0}'' of class ''{1}'' not found. classNotFound=Class not found: ''{0}'' -standardCtorExists=Skipping class ''{0}''. The class already declares a public no-arg constructor. -copyCtorExists=Skipping class ''{0}''. The class already declares a copy constructor. -copiesReference=Field ''{0}'' of class ''{1}'' has no properties. Copies object reference. -clonesReference=Cloneable field ''{0}'' of class ''{1}'' has no properties. Clones object reference. +standardCtorExists=Not adding public no-arg constructor to class ''{0}''. The class already declares a public no-arg constructor. +copyCtorExists=Not adding copy constructor to class ''{0}''. The class already declares a copy constructor. usage=-copy-constructor\t:\tenable generation of copy constructors. methodNotFound=Method not found: ''{0}'' +cannotCopyProperty=Cannot copy property ''{0}'' of class ''{1}''. Copying reference. +methodExists=Not adding ''{0}'' method to class ''{1}''. The class already declares a ''{0}'' method. +couldNotAddMethod=Could not add ''{0}'' method to class ''{1}''. +title=CC-XJC Version ${pom.version} Build ${buildNumber} +cannotCopyField=Cannot copy field ''{0}'' of class ''{1}''. Copying reference. Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-05-03 01:59:32 UTC (rev 20) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-05-04 15:44:02 UTC (rev 21) @@ -1,12 +1,14 @@ couldNotAddStdCtor=Konnte keinen \u00F6ffentlichen Standard-Konstruktor zur Klasse ''{0}'' hinzuf\u00FCgen. couldNotAddCopyCtor=Konnte keinen Kopier-Konstruktor zur Klasse ''{0}'' hinzuf\u00FCgen. -multipleTypes=Die ''{0}'' Eigenschaft der Klasse ''{1}'' referenziert mehrere Typen ({2,number}). -noTypes=Die ''{0}'' Eigenschaft der Klasse ''{1}'' referenziert keine Typen. -noGetter=Accessor-Methode f\u00FCr ''{0}'' Eigenschaft der Klasse ''{1}'' nicht gefunden. +typesNotFound=Die ''{0}'' Eigenschaft der Klasse ''{1}'' referenziert keine Typen. +getterNotNound=Accessor-Methode f\u00FCr ''{0}'' Eigenschaft der Klasse ''{1}'' nicht gefunden. classNotFound=Klasse nicht gefunden: ''{0}'' standardCtorExists=Klasse ''{0}'' besitzt bereits einen \u00F6ffentlichen Standard-Konstruktor. Keinen Quelltext erzeugt. copyCtorExists=Klasse ''{0}'' besitzt bereits einen Kopier-Konstruktor. Keinen Quelltext erzeugt. -copiesReference=Feld ''{0}'' der Klasse ''{1}'' verf\u00FCgt \u00FCber keine Eigenschaften. Kopiert Objekt-Referenz. -clonesReference=Klonbares Feld ''{0}'' der Klasse ''{1}'' verf\u00FCgt \u00FCber keine Eigenschaften. Klont Objekt-Referenz. usage=-copy-constructor\t:\taktiviert die Generierung von Kopier-Konstruktoren. methodNotFound=Methode nicht gefunden: ''{0}'' +cannotCopyProperty=Eigenschaft ''{0}'' der Klasse ''{1}'' kann nicht kopiert werden. Kopiert Referenz. +methodExists=Klasse ''{1}'' besitzt bereits eine ''{0}'' Methode. Keinen Quelltext erzeugt. +couldNotAddMethod=Konnte ''{0}'' Methode nicht zur Klasse ''{1}'' hinzuf\u00FCgen. +title=CC-XJC Version ${pom.version} Build ${buildNumber} +cannotCopyField=Feld ''{0}'' der Klasse ''{1}'' kann nicht kopiert werden. Kopiert Referenz. Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-05-03 01:59:32 UTC (rev 20) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-05-04 15:44:02 UTC (rev 21) @@ -1,12 +1,14 @@ couldNotAddStdCtor=Could not add a public no-arg constructor to class ''{0}''. couldNotAddCopyCtor=Could not add a copy constructor to class ''{0}''. -multipleTypes=Collection property ''{0}'' of class ''{1}'' references multiple types ({2,number}). -noTypes=Collection property ''{0}'' of class ''{1}'' references no types. -noGetter=Getter for property ''{0}'' of class ''{1}'' not found. +typesNotFound=Collection property ''{0}'' of class ''{1}'' references no types. +getterNotNound=Getter for property ''{0}'' of class ''{1}'' not found. classNotFound=Class not found: ''{0}'' -standardCtorExists=Skipping class ''{0}''. The class already declares a public no-arg constructor. -copyCtorExists=Skipping class ''{0}''. The class already declares a copy constructor. -copiesReference=Field ''{0}'' of class ''{1}'' has no properties. Copies object reference. -clonesReference=Cloneable field ''{0}'' of class ''{1}'' has no properties. Clones object reference. +standardCtorExists=Not adding public no-arg constructor to class ''{0}''. The class already declares a public no-arg constructor. +copyCtorExists=Not adding copy constructor to class ''{0}''. The class already declares a copy constructor. usage=-copy-constructor\t:\tenable generation of copy constructors. methodNotFound=Method not found: ''{0}'' +cannotCopyProperty=Cannot copy property ''{0}'' of class ''{1}''. Copying reference. +methodExists=Not adding ''{0}'' method to class ''{1}''. The class already declares a ''{0}'' method. +couldNotAddMethod=Could not add ''{0}'' method to class ''{1}''. +title=CC-XJC Version ${pom.version} Build ${buildNumber} +cannotCopyField=Cannot copy field ''{0}'' of class ''{1}''. Copying reference. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-05-07 07:10:54
|
Revision: 30 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=30&view=rev Author: schulte2005 Date: 2009-05-07 07:10:46 +0000 (Thu, 07 May 2009) Log Message: ----------- o Documentation updates. Modified Paths: -------------- trunk/pom.xml trunk/src/main/assembly/bin.xml trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties trunk/src/site/apt/index.apt trunk/src/site/apt/license-info.apt trunk/src/site/site.xml Added Paths: ----------- trunk/src/main/books/cc-xjc.xml trunk/src/site/apt/download.apt trunk/src/site/apt/examples.apt Removed Paths: ------------- trunk/src/main/books/cc-xjc-manual.xml trunk/src/site/apt/maven.apt Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/pom.xml 2009-05-07 07:10:46 UTC (rev 30) @@ -244,7 +244,7 @@ <version>1.1</version> <executions> <execution> - <phase>package</phase> + <phase>generate-resources</phase> <goals> <goal>render-books</goal> </goals> @@ -254,7 +254,7 @@ <books> <book> <directory>src/site/apt</directory> - <descriptor>src/main/books/cc-xjc-manual.xml</descriptor> + <descriptor>src/main/books/cc-xjc.xml</descriptor> <formats> <format> <id>xhtml</id> @@ -264,6 +264,10 @@ </books> </configuration> </plugin> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.3</version> + </plugin> </plugins> </pluginManagement> <plugins> @@ -276,6 +280,25 @@ <artifactId>doxia-maven-plugin</artifactId> </plugin> <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>copy-resources</id> + <phase>process-resources</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + <copy file="${project.build.directory}/generated-site/xhtml/cc-xjc/cc-xjc.xhtml" + tofile="${project.build.outputDirectory}/META-INF/README.html"/> + + </tasks> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <artifactId>maven-assembly-plugin</artifactId> </plugin> </plugins> Modified: trunk/src/main/assembly/bin.xml =================================================================== --- trunk/src/main/assembly/bin.xml 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/main/assembly/bin.xml 2009-05-07 07:10:46 UTC (rev 30) @@ -39,8 +39,8 @@ </formats> <files> <file> - <source>${project.build.directory}/generated-site/xhtml/cc-xjc-manual/cc-xjc-manual.xhtml</source> - <destName>CC-XJC ${pom.version}.html</destName> + <source>${project.build.directory}/generated-site/xhtml/cc-xjc/cc-xjc.xhtml</source> + <destName>README.html</destName> <outputDirectory>/</outputDirectory> <fileMode>0644</fileMode> <filtered>false</filtered> Deleted: trunk/src/main/books/cc-xjc-manual.xml =================================================================== --- trunk/src/main/books/cc-xjc-manual.xml 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/main/books/cc-xjc-manual.xml 2009-05-07 07:10:46 UTC (rev 30) @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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. - - $Id$ - ---> -<book xmlns="http://maven.apache.org/BOOK/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/BOOK/1.0.0 ../../../doxia/doxia-book/target/generated-site/xsd/book-1.0.0.xsd"> - <id>cc-xjc-manual</id> - <title>CC-XJC Manual</title> - <chapters> - <chapter> - <id>index</id> - <title>Introduction</title> - <sections> - <section> - <id>index</id> - </section> - </sections> - </chapter> - <chapter> - <id>maven</id> - <title>Maven</title> - <sections> - <section> - <id>maven</id> - </section> - </sections> - </chapter> - <chapter> - <id>license-info</id> - <title>License</title> - <sections> - <section> - <id>license-info</id> - </section> - </sections> - </chapter> - </chapters> -</book> Copied: trunk/src/main/books/cc-xjc.xml (from rev 29, trunk/src/main/books/cc-xjc-manual.xml) =================================================================== --- trunk/src/main/books/cc-xjc.xml (rev 0) +++ trunk/src/main/books/cc-xjc.xml 2009-05-07 07:10:46 UTC (rev 30) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<book xmlns="http://maven.apache.org/BOOK/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/BOOK/1.0.0 http://maven.apache.org/xsd/book-1.0.0.xsd"> + <id>cc-xjc</id> + <title>CC-XJC</title> + <chapters> + <chapter> + <id>cc-xjc</id> + <title>CC-XJC</title> + <sections> + <section> + <id>index</id> + </section> + <section> + <id>examples</id> + </section> + <section> + <id>download</id> + </section> + <section> + <id>license-info</id> + </section> + </sections> + </chapter> + </chapters> +</book> Property changes on: trunk/src/main/books/cc-xjc.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:mergeinfo + Added: svn:eol-style + native Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-05-07 07:10:46 UTC (rev 30) @@ -1,3 +1,4 @@ +#$Id:$ couldNotAddStdCtor=Could not add a public no-arg constructor to class ''{0}''. couldNotAddCopyCtor=Could not add a copy constructor to class ''{0}''. typesNotFound=Collection property ''{0}'' of class ''{1}'' references no types. Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-05-07 07:10:46 UTC (rev 30) @@ -1,3 +1,4 @@ +#$Id:$ couldNotAddStdCtor=Konnte keinen \u00F6ffentlichen Standard-Konstruktor zur Klasse ''{0}'' hinzuf\u00FCgen. couldNotAddCopyCtor=Konnte keinen Kopier-Konstruktor zur Klasse ''{0}'' hinzuf\u00FCgen. typesNotFound=Die ''{0}'' Eigenschaft der Klasse ''{1}'' referenziert keine Typen. Modified: trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties =================================================================== --- trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-05-07 07:10:46 UTC (rev 30) @@ -1,3 +1,4 @@ +#$Id:$ couldNotAddStdCtor=Could not add a public no-arg constructor to class ''{0}''. couldNotAddCopyCtor=Could not add a copy constructor to class ''{0}''. typesNotFound=Collection property ''{0}'' of class ''{1}'' references no types. Added: trunk/src/site/apt/download.apt =================================================================== --- trunk/src/site/apt/download.apt (rev 0) +++ trunk/src/site/apt/download.apt 2009-05-07 07:10:46 UTC (rev 30) @@ -0,0 +1,49 @@ + ----- +Download + ----- +Christian Schulte + ----- +May 2009 + ----- + +~~ 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. +~~ +~~ $Id$ +~~ + +Download + +* Releases + + Releases are deployed to the Sourceforge file release system. Please see the + {{{https://sourceforge.net/project/showfiles.php?group_id=260900}Sourceforge FRS}}. + +* Snapshots + + Development snapshots are deployed to the CC-XJC snapshot repository and + are available for downloaded from there. Please see group + {{{http://ccxjc.sourceforge.net/maven2/snapshots/net/sourceforge/ccxjc/}net.sourceforge.ccxjc}}. Property changes on: trunk/src/site/apt/download.apt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Copied: trunk/src/site/apt/examples.apt (from rev 26, trunk/src/site/apt/maven.apt) =================================================================== --- trunk/src/site/apt/examples.apt (rev 0) +++ trunk/src/site/apt/examples.apt 2009-05-07 07:10:46 UTC (rev 30) @@ -0,0 +1,142 @@ + ----- +Examples + ----- +Christian Schulte + ----- +May 2009 + ----- + +~~ 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. +~~ +~~ $Id$ +~~ + +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>ccxjc-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-4</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</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>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> + <url>http://download.java.net/maven/2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> +</repositories> + +<pluginRepositories> + <pluginRepository> + <id>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> + <url>http://download.java.net/maven/2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> +</pluginRepositories> +--- Property changes on: trunk/src/site/apt/examples.apt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:mergeinfo + Added: svn:eol-style + native Modified: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/site/apt/index.apt 2009-05-07 07:10:46 UTC (rev 30) @@ -1,5 +1,5 @@ ----- -CC-XJC +About ----- Christian Schulte ----- @@ -35,18 +35,25 @@ ~~ $Id$ ~~ -Introduction +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 + derived classes. The plugin provides a '-copy-constructor' option which is enabled by adding its jar file to the XJC classpath. That option takes no - parameters. + parameters. See the examples for further information. -Support +* Support - Development of CC-XJC is driven by the community. Please file any issues with - the {{{https://apps.sourceforge.net/mantisbt/ccxjc/}MantisBT}} bugracker or + Development of CC-XJC is community driven. Please file any issues with the + {{{https://apps.sourceforge.net/mantisbt/ccxjc/}MantisBT}} bugtracker or subscribe to the {{{http://ccxjc.sourceforge.net/mail-lists.html}ccxjc-users}} - mailing list for discussing issues or asking questions. Additional information - may also be available in the - {{{https://apps.sourceforge.net/mediawiki/ccxjc/index.php?title=Main_Page}wiki}}. + mailing list for discussing issues or asking questions. The + {{{http://apps.sourceforge.net/ideatorrent/ccxjc/}IdeaTorrent}} is used to + collect ideas. You may also want to use + {{{https://apps.sourceforge.net/mediawiki/ccxjc/index.php?title=Main_Page}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, you can create an account for free at + {{{http://sourceforge.net}Sourceforge}}. Modified: trunk/src/site/apt/license-info.apt =================================================================== --- trunk/src/site/apt/license-info.apt 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/site/apt/license-info.apt 2009-05-07 07:10:46 UTC (rev 30) @@ -1,5 +1,5 @@ ----- -CC-XJC +License ----- Christian Schulte ----- @@ -35,8 +35,10 @@ ~~ $Id$ ~~ -The CC-XJC Project Copyright +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 Deleted: trunk/src/site/apt/maven.apt =================================================================== --- trunk/src/site/apt/maven.apt 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/site/apt/maven.apt 2009-05-07 07:10:46 UTC (rev 30) @@ -1,148 +0,0 @@ - ----- -CC-XJC - ----- -Christian Schulte - ----- -May 2009 - ----- - -~~ 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. -~~ -~~ $Id$ -~~ - -Maven Information - - 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.xml. - ---- - - <repository> - <id>ccxjc.sourceforge.net</id> - <url>http://ccxjc.sourceforge.net/maven2/releases</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - ---- - -Example - - 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-2</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</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>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> - <url>http://download.java.net/maven/2</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> -</repositories> - -<pluginRepositories> - <pluginRepository> - <id>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> - <url>http://download.java.net/maven/2</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </pluginRepository> -</pluginRepositories> - ---- Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2009-05-07 04:09:30 UTC (rev 29) +++ trunk/src/site/site.xml 2009-05-07 07:10:46 UTC (rev 30) @@ -36,6 +36,13 @@ <artifactId>maven-classic-skin</artifactId> <version>1.0</version> </skin> + + <bannerRight> + <name>Sourceforge.net</name> + <src>http://sflogo.sourceforge.net/sflogo.php?group_id=260900&type=11</src> + <href>http://sourceforge.net/projects/ccxjc</href> + </bannerRight> + <body> <head> <meta name="keywords" content="xjc, jaxb, plugin, schema, java, xml, xsd, constructor, copy, copy-constructor, ctor, copy-ctor,"/> @@ -43,12 +50,14 @@ <menu name="CC-XJC"> <item name="About" href="index.html"/> - <item name="Maven Information" href="maven.html"/> + <item name="Examples" href="examples.html"/> + <item name="Download" href="download.html"/> </menu> <menu name="Sourceforge"> - <item name="Project Summary" href="https://sourceforge.net/projects/ccxjc/"/> - <item name="Download" href="https://sourceforge.net/project/showfiles.php?group_id=260900"/> + <item name="Project Summary" href="http://sourceforge.net/projects/ccxjc/"/> + <item name="MantisBT" href="http://apps.sourceforge.net/mantisbt/ccxjc/"/> + <item name="IdeaTorrent" href="http://apps.sourceforge.net/ideatorrent/ccxjc/"/> </menu> <menu ref="reports" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-07-26 04:58:41
|
Revision: 47 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=47&view=rev Author: schulte2005 Date: 2009-07-26 04:58:21 +0000 (Sun, 26 Jul 2009) Log Message: ----------- o Updated the site to reference the current version. Modified Paths: -------------- trunk/pom.xml trunk/src/site/apt/download.apt Added Paths: ----------- trunk/src/site/apt/examples.apt.vm Removed Paths: ------------- trunk/src/site/apt/examples.apt Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-07-26 04:52:29 UTC (rev 46) +++ trunk/pom.xml 2009-07-26 04:58:21 UTC (rev 47) @@ -507,5 +507,6 @@ <properties> <jaxbApiVersion>2.0</jaxbApiVersion> <jaxbImplVersion>2.0.5</jaxbImplVersion> + <currentVersion>${pom.version}</currentVersion> </properties> -</project> \ No newline at end of file +</project> Modified: trunk/src/site/apt/download.apt =================================================================== --- trunk/src/site/apt/download.apt 2009-07-26 04:52:29 UTC (rev 46) +++ trunk/src/site/apt/download.apt 2009-07-26 04:58:21 UTC (rev 47) @@ -54,7 +54,7 @@ --- <repository> - <id>ccxjc-snapshots</id> + <id>http://ccxjc.sourceforge.net/maven2/snapshots</id> <url>http://ccxjc.sourceforge.net/maven2/snapshots</url> <releases> <enabled>false</enabled> Deleted: trunk/src/site/apt/examples.apt =================================================================== --- trunk/src/site/apt/examples.apt 2009-07-26 04:52:29 UTC (rev 46) +++ trunk/src/site/apt/examples.apt 2009-07-26 04:58:21 UTC (rev 47) @@ -1,142 +0,0 @@ - ----- -Examples - ----- -Christian Schulte - ----- -May 2009 - ----- - -~~ 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. -~~ -~~ $Id$ -~~ - -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>ccxjc-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-5</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</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>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> - <url>http://download.java.net/maven/2</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> -</repositories> - -<pluginRepositories> - <pluginRepository> - <id>maven1-repository.dev.java.net</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>maven2-repository.dev.java.net</id> - <url>http://download.java.net/maven/2</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </pluginRepository> -</pluginRepositories> ---- Copied: trunk/src/site/apt/examples.apt.vm (from rev 46, trunk/src/site/apt/examples.apt) =================================================================== --- trunk/src/site/apt/examples.apt.vm (rev 0) +++ trunk/src/site/apt/examples.apt.vm 2009-07-26 04:58:21 UTC (rev 47) @@ -0,0 +1,142 @@ + ----- +Examples + ----- +Christian Schulte + ----- +May 2009 + ----- + +~~ 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. +~~ +~~ $Id$ +~~ + +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>${currentVersion}</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</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> +--- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-07-26 05:28:42
|
Revision: 48 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=48&view=rev Author: schulte2005 Date: 2009-07-26 05:28:20 +0000 (Sun, 26 Jul 2009) Log Message: ----------- o Reverted last commit since filtering site documents is not supported by the doxia and the pdf plugin. Modified Paths: -------------- trunk/pom.xml Added Paths: ----------- trunk/src/site/apt/examples.apt Removed Paths: ------------- trunk/src/site/apt/examples.apt.vm Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-07-26 04:58:21 UTC (rev 47) +++ trunk/pom.xml 2009-07-26 05:28:20 UTC (rev 48) @@ -507,6 +507,5 @@ <properties> <jaxbApiVersion>2.0</jaxbApiVersion> <jaxbImplVersion>2.0.5</jaxbImplVersion> - <currentVersion>${pom.version}</currentVersion> </properties> </project> Copied: trunk/src/site/apt/examples.apt (from rev 47, trunk/src/site/apt/examples.apt.vm) =================================================================== --- trunk/src/site/apt/examples.apt (rev 0) +++ trunk/src/site/apt/examples.apt 2009-07-26 05:28:20 UTC (rev 48) @@ -0,0 +1,142 @@ + ----- +Examples + ----- +Christian Schulte + ----- +May 2009 + ----- + +~~ 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. +~~ +~~ $Id$ +~~ + +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-6</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</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> +--- Deleted: trunk/src/site/apt/examples.apt.vm =================================================================== --- trunk/src/site/apt/examples.apt.vm 2009-07-26 04:58:21 UTC (rev 47) +++ trunk/src/site/apt/examples.apt.vm 2009-07-26 05:28:20 UTC (rev 48) @@ -1,142 +0,0 @@ - ----- -Examples - ----- -Christian Schulte - ----- -May 2009 - ----- - -~~ 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. -~~ -~~ $Id$ -~~ - -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>${currentVersion}</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</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> ---- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-16 01:12:16
|
Revision: 52 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=52&view=rev Author: schulte2005 Date: 2009-08-16 01:12:03 +0000 (Sun, 16 Aug 2009) Log Message: ----------- o Added support for various property types not supported prior to this version (collectionType="indexed", generateValueClass="false", etc.). o Split into multiple artifacts to support testing the plugin during building. Modified Paths: -------------- trunk/cc-xjc-dist/src/main/assembly/bin.xml trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties trunk/pom.xml trunk/src/main/changes/changes.xml trunk/src/site/apt/examples.apt trunk/src/site/apt/index.apt Added Paths: ----------- trunk/cc-xjc-dist/ trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-dist/src/ trunk/cc-xjc-dist/src/main/ trunk/cc-xjc-dist/src/main/assembly/ trunk/cc-xjc-it/ trunk/cc-xjc-it/pom.xml trunk/cc-xjc-it/src/ trunk/cc-xjc-it/src/main/ trunk/cc-xjc-it/src/main/java/ trunk/cc-xjc-it/src/main/java/net/ trunk/cc-xjc-it/src/main/java/net/sourceforge/ trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/ trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java trunk/cc-xjc-it/src/main/jaxb/ trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-package.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-private.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-protected.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-public.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-package.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-private.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-protected.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-public.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-package.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-private.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-protected.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-public.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-package.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-private.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-protected.xjb trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-public.xjb trunk/cc-xjc-it/src/main/schemas/ trunk/cc-xjc-it/src/main/schemas/application-client_5.xsd trunk/cc-xjc-it/src/main/schemas/application_5.xsd trunk/cc-xjc-it/src/main/schemas/assembly-1.1.1.xsd trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd trunk/cc-xjc-it/src/main/schemas/changes-1.0.0.xsd trunk/cc-xjc-it/src/main/schemas/decoration-1.0.0.xsd trunk/cc-xjc-it/src/main/schemas/ebics.xsd trunk/cc-xjc-it/src/main/schemas/ebics_hev.xsd trunk/cc-xjc-it/src/main/schemas/ebics_keymgmt_request.xsd trunk/cc-xjc-it/src/main/schemas/ebics_keymgmt_response.xsd trunk/cc-xjc-it/src/main/schemas/ebics_orders.xsd trunk/cc-xjc-it/src/main/schemas/ebics_request.xsd trunk/cc-xjc-it/src/main/schemas/ebics_response.xsd trunk/cc-xjc-it/src/main/schemas/ebics_signature.xsd trunk/cc-xjc-it/src/main/schemas/ebics_types.xsd trunk/cc-xjc-it/src/main/schemas/ejb-jar_3_0.xsd trunk/cc-xjc-it/src/main/schemas/javaee_5.xsd trunk/cc-xjc-it/src/main/schemas/javaee_web_services_1_2.xsd trunk/cc-xjc-it/src/main/schemas/javaee_web_services_client_1_2.xsd trunk/cc-xjc-it/src/main/schemas/javaee_web_services_metadata_handler_2_0.xsd trunk/cc-xjc-it/src/main/schemas/jdtaus-container-1.1.xsd trunk/cc-xjc-it/src/main/schemas/jomc-1.0.xsd trunk/cc-xjc-it/src/main/schemas/jsp_2_1.xsd trunk/cc-xjc-it/src/main/schemas/maven-v4_0_0.xsd trunk/cc-xjc-it/src/main/schemas/orm_1_0.xsd trunk/cc-xjc-it/src/main/schemas/persistence_1_0.xsd trunk/cc-xjc-it/src/main/schemas/portlet-app_1_0.xsd trunk/cc-xjc-it/src/main/schemas/portlet-app_2_0.xsd trunk/cc-xjc-it/src/main/schemas/profiles-1.0.0.xsd trunk/cc-xjc-it/src/main/schemas/settings-1.0.0.xsd trunk/cc-xjc-it/src/main/schemas/spring-aop-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-beans-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-context-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-jee-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-jms-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-lang-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-osgi.xsd trunk/cc-xjc-it/src/main/schemas/spring-tool-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-tx-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-util-2.5.xsd trunk/cc-xjc-it/src/main/schemas/spring-webflow-config-1.0.xsd trunk/cc-xjc-it/src/main/schemas/web-app_2_5.xsd trunk/cc-xjc-it/src/main/schemas/web-facesconfig_1_2.xsd trunk/cc-xjc-it/src/main/schemas/web-jsptaglibrary_2_1.xsd trunk/cc-xjc-it/src/main/schemas/ws-addr.xsd trunk/cc-xjc-it/src/main/schemas/wsmc-1.0-schema-200702.xsd trunk/cc-xjc-it/src/main/schemas/wsrm-1.1-schema-200702.xsd trunk/cc-xjc-it/src/main/schemas/wsrmp-1.1-schema-200702.xsd trunk/cc-xjc-it/src/main/schemas/xml.xsd trunk/cc-xjc-it/src/main/schemas/xmldsig-core-schema.xsd trunk/cc-xjc-plugin/ trunk/cc-xjc-plugin/pom.xml trunk/cc-xjc-plugin/src/ trunk/cc-xjc-plugin/src/main/ trunk/cc-xjc-plugin/src/main/java/ trunk/cc-xjc-plugin/src/main/javadoc/ trunk/cc-xjc-plugin/src/main/resources/ Removed Paths: ------------- trunk/src/main/assembly/ trunk/src/main/java/ trunk/src/main/javadoc/ trunk/src/main/resources/ Property changes on: trunk/cc-xjc-dist ___________________________________________________________________ Added: svn:ignore + target Added: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml (rev 0) +++ trunk/cc-xjc-dist/pom.xml 2009-08-16 01:12:03 UTC (rev 52) @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sourceforge.ccxjc</groupId> + <artifactId>cc-xjc</artifactId> + <version>1.0-beta-7-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cc-xjc-dist</artifactId> + <packaging>pom</packaging> + <name>CC-XJC Distribution</name> + <description>JAXB 2.0 Schema to Java compiler plugin binary distribution.</description> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>validate</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/artifacts</outputDirectory> + <artifactItems> + <artifactItem> + <groupId>${pom.groupId}</groupId> + <artifactId>cc-xjc</artifactId> + <version>${pom.version}</version> + <type>xhtml</type> + <outputDirectory>${project.build.directory}</outputDirectory> + <destFileName>README.xhtml</destFileName> + </artifactItem> + <artifactItem> + <groupId>${pom.groupId}</groupId> + <artifactId>cc-xjc</artifactId> + <version>${pom.version}</version> + <type>lic</type> + <outputDirectory>${project.build.directory}</outputDirectory> + <destFileName>LICENSE.txt</destFileName> + </artifactItem> + <artifactItem> + <groupId>${pom.groupId}</groupId> + <artifactId>cc-xjc-plugin</artifactId> + <version>${pom.version}</version> + <type>jar</type> + <outputDirectory>${project.build.directory}</outputDirectory> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>bin</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptors> + <descriptor>src/main/assembly/bin.xml</descriptor> + </descriptors> + <finalName>cc-xjc-${pom.version}</finalName> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> Property changes on: trunk/cc-xjc-dist/pom.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Property changes on: trunk/cc-xjc-dist/src/main/assembly ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/cc-xjc-dist/src/main/assembly/bin.xml =================================================================== --- trunk/src/main/assembly/bin.xml 2009-07-26 05:33:33 UTC (rev 51) +++ trunk/cc-xjc-dist/src/main/assembly/bin.xml 2009-08-16 01:12:03 UTC (rev 52) @@ -30,25 +30,37 @@ $Id$ --> -<assembly> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd"> <id>bin</id> <formats> <format>tar.gz</format> <format>tar.bz2</format> <format>zip</format> </formats> - <files> - <file> - <source>${project.build.directory}/generated-site/xhtml/cc-xjc/cc-xjc.xhtml</source> - <destName>README.html</destName> + <fileSets> + <fileSet> + <directory>${project.build.directory}</directory> + <directoryMode>0755</directoryMode> + <fileMode>0644</fileMode> + <filtered>true</filtered> + <lineEnding>dos</lineEnding> <outputDirectory>/</outputDirectory> + <includes> + <include>*.xhtml</include> + <include>*.txt</include> + </includes> + </fileSet> + <fileSet> + <directory>${project.build.directory}</directory> + <directoryMode>0755</directoryMode> <fileMode>0644</fileMode> <filtered>false</filtered> - </file> - </files> - <dependencySets> - <dependencySet> - <fileMode>0755</fileMode> - </dependencySet> - </dependencySets> + <outputDirectory>/</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + </fileSet> + </fileSets> </assembly> Property changes on: trunk/cc-xjc-it ___________________________________________________________________ Added: svn:ignore + target Added: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml (rev 0) +++ trunk/cc-xjc-it/pom.xml 2009-08-16 01:12:03 UTC (rev 52) @@ -0,0 +1,448 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sourceforge.ccxjc</groupId> + <artifactId>cc-xjc</artifactId> + <version>1.0-beta-7-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cc-xjc-it</artifactId> + <packaging>jar</packaging> + <name>CC-XJC Test Suite</name> + <description>JAXB 2.0 Schema to Java compiler plugin test suite.</description> + <build> + <plugins> + <plugin> + <artifactId>build-helper-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <executions> + <execution> + <id>maven-version</id> + <phase>validate</phase> + <goals> + <goal>maven-version</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.jvnet.jaxb2.maven2</groupId> + <artifactId>maven-jaxb2-plugin</artifactId> + <executions> + + <execution> + <id>xjc-default-collection-type-private</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>private</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-collections-private.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-indexed-collection-type-private</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>private</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-indexed-private.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-default-collection-type-no-value-class-private</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>private</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-collections-no-value-class-private.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-indexed-collection-type-no-value-class-private</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>private</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-indexed-no-value-class-private.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + + <execution> + <id>xjc-default-collection-type-package</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-collections-package.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-indexed-collection-type-package</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-indexed-package.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-default-collection-type-no-value-class-package</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-collections-no-value-class-package.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-indexed-collection-type-no-value-class-package</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-indexed-no-value-class-package.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + + <execution> + <id>xjc-default-collection-type-protected</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>protected</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-collections-protected.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-indexed-collection-type-protected</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>protected</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-indexed-protected.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-default-collection-type-no-value-class-protected</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>protected</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-collections-no-value-class-protected.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-indexed-collection-type-no-value-class-protected</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>protected</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-indexed-no-value-class-protected.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + + <execution> + <id>xjc-default-collection-type-public</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>public</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-collections-public.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-indexed-collection-type-public</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>public</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-indexed-public.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-default-collection-type-no-value-class-public</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>public</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-collections-no-value-class-public.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + <execution> + <id>xjc-indexed-collection-type-no-value-class-public</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <args> + <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>public</arg> + </args> + <schemaDirectory>src/main/schemas</schemaDirectory> + <bindingDirectory>src/main/jaxb</bindingDirectory> + <bindingIncludes> + <bindingInclude>cc-xjc-it-indexed-no-value-class-public.xjb</bindingInclude> + </bindingIncludes> + <extension>true</extension> + <episode>false</episode> + <forceRegenerate>true</forceRegenerate> + </configuration> + </execution> + + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory> + <testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>2.1.12</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> Property changes on: trunk/cc-xjc-it/pom.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java =================================================================== --- trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java (rev 0) +++ trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java 2009-08-16 01:12:03 UTC (rev 52) @@ -0,0 +1,320 @@ +/* + * 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: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * o 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. + * + * $Id$ + */ +package net.sourceforge.ccxjc.it; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.Duration; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; +import junit.framework.Assert; +import net.sourceforge.ccxjc.it.model.priv.collections.valueclass.ccxjcit.SimpleTypeAttributes; +import org.apache.commons.lang.SerializationUtils; + +/** + * Tests the {@code SimpleTypeAttributes} complex type. + * + * @author <a href="mailto:cs...@sc...">Christian Schulte</a> + * @version $Id$ + */ +public class SimpleTypeAttributesCollectionsTest +{ + + private static final String CCXJC_NS = "http://sourceforge.net/ccxjc/it"; + + private XMLGregorianCalendar testCalendar; + + private Duration testDuration; + + private byte[] testBytes; + + private List<String> testEntities; + + private List<Object> testIdRefs; + + private List<String> testTokens; + + private QName testQName; + + public XMLGregorianCalendar getTestCalendar() throws DatatypeConfigurationException + { + if ( this.testCalendar == null ) + { + this.testCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(); + } + + return this.testCalendar; + } + + public Duration getTestDuration() throws DatatypeConfigurationException + { + if ( this.testDuration == null ) + { + this.testDuration = DatatypeFactory.newInstance().newDuration( 1000L ); + } + + return this.testDuration; + } + + public byte[] getTestBytes() + { + if ( this.testBytes == null ) + { + this.testBytes = new byte[ 256 ]; + for ( int i = 255; i >= 0; i-- ) + { + this.testBytes[i] = (byte) i; + } + } + + return this.testBytes; + } + + public List<String> getTestEntities() + { + if ( this.testEntities == null ) + { + this.testEntities = Arrays.asList( new String[] + { + "ENTITY 1", "ENTITY 2", "ENTITY 3" + } ); + + } + + return this.testEntities; + } + + public List<Object> getTestIdRefs() + { + if ( this.testIdRefs == null ) + { + this.testIdRefs = Arrays.asList( new Object[] + { + "ID" + } ); + + } + + return this.testIdRefs; + } + + public List<String> getTestTokens() + { + if ( this.testTokens == null ) + { + this.testTokens = Arrays.asList( new String[] + { + "NMTOKEN 1", "NMTOKEN 2", "NMTOKEN 3" + } ); + + } + + return this.testTokens; + } + + public QName getTestQName() + { + if ( this.testQName == null ) + { + this.testQName = new QName( CCXJC_NS, "ID" ); + } + + return this.testQName; + } + + public void assertTestBytes( final byte[] bytes ) + { + Assert.assertTrue( Arrays.equals( this.getTestBytes(), bytes ) ); + } + + public SimpleTypeAttributes getTestSimpleTypeAttributes() throws DatatypeConfigurationException + { + final SimpleTypeAttributes t = new SimpleTypeAttributes(); + + t.setAnySimpleType( "any" ); + t.setAnyURI( "anyURI" ); + t.setBase64Binary( this.getTestBytes() ); + t.setBoolean( true ); + t.setByte( (byte) 1 ); + t.setDate( this.getTestCalendar() ); + t.setDateTime( this.getTestCalendar() ); + t.setDecimal( BigDecimal.TEN ); + t.setDouble( 100.0D ); + t.setDuration( this.getTestDuration() ); + t.setENTITY( "ENTITY" ); + t.setFloat( 100.0F ); + t.setGDay( this.getTestCalendar() ); + t.setGMonth( this.getTestCalendar() ); + t.setGMonthDay( this.getTestCalendar() ); + t.setGYear( this.getTestCalendar() ); + t.setGYearMonth( this.getTestCalendar() ); + t.setHexBinary( this.getTestBytes() ); + t.setID( "ID" ); + t.setIDREF( "ID" ); + t.setInt( 100 ); + t.setInteger( BigInteger.TEN ); + t.setLanguage( "en" ); + t.setLong( 100L ); + t.setNCName( "NCName" ); + t.setNMTOKEN( "NMTOKEN" ); + t.setNOTATION( this.getTestQName() ); + t.setName( "name" ); + t.setNegativeInteger( BigInteger.valueOf( -100L ) ); + t.setNonNegativeInteger( BigInteger.TEN ); + t.setNonPositiveInteger( BigInteger.valueOf( -100L ) ); + t.setNormalizedString( "normalized" ); + t.setPositiveInteger( BigInteger.TEN ); + t.setQName( this.getTestQName() ); + t.setShort( (short) 100 ); + t.setString( "String" ); + t.setTime( DatatypeFactory.newInstance().newXMLGregorianCalendar() ); + t.setToken( "Token" ); + t.setUnsignedByte( (short) 100 ); + t.setUnsignedInt( 100L ); + t.setUnsignedLong( BigInteger.TEN ); + t.setUnsignedShort( 100 ); + + t.getENTITIES().addAll( this.getTestEntities() ); + t.getIDREFS().addAll( this.getTestIdRefs() ); + t.getNMTOKENS().addAll( this.getTestTokens() ); + + return t; + } + + public void assertTestSimpleTypeAttributes( final SimpleTypeAttributes a ) throws DatatypeConfigurationException + { + Assert.assertEquals( "any", a.getAnySimpleType() ); + Assert.assertEquals( "anyURI", a.getAnyURI() ); + this.assertTestBytes( a.getBase64Binary() ); + Assert.assertEquals( true, a.isBoolean() ); + Assert.assertEquals( 1, a.getByte() ); + Assert.assertEquals( this.getTestCalendar(), a.getDate() ); + Assert.assertEquals( this.getTestCalendar(), a.getDateTime() ); + Assert.assertEquals( BigDecimal.TEN, a.getDecimal() ); + Assert.assertEquals( 100.0D, a.getDouble() ); + Assert.assertEquals( this.getTestDuration(), a.getDuration() ); + Assert.assertEquals( this.getTestEntities(), a.getENTITIES() ); + Assert.assertEquals( "ENTITY", a.getENTITY() ); + Assert.assertEquals( 100.0F, a.getFloat() ); + Assert.assertEquals( this.getTestCalendar(), a.getGDay() ); + Assert.assertEquals( this.getTestCalendar(), a.getGMonth() ); + Assert.assertEquals( this.getTestCalendar(), a.getGMonthDay() ); + Assert.assertEquals( this.getTestCalendar(), a.getGYear() ); + Assert.assertEquals( this.getTestCalendar(), a.getGYearMonth() ); + this.assertTestBytes( a.getHexBinary() ); + Assert.assertEquals( "ID", a.getID() ); + Assert.assertEquals( "ID", a.getIDREF() ); + Assert.assertEquals( this.getTestIdRefs(), a.getIDREFS() ); + Assert.assertEquals( 100, a.getInt() ); + Assert.assertEquals( BigInteger.TEN, a.getInteger() ); + Assert.assertEquals( "en", a.getLanguage() ); + Assert.assertEquals( 100L, a.getLong() ); + Assert.assertEquals( "NCName", a.getNCName() ); + Assert.assertEquals( "NMTOKEN", a.getNMTOKEN() ); + Assert.assertEquals( this.getTestTokens(), a.getNMTOKENS() ); + Assert.assertEquals( this.getTestQName(), a.getNOTATION() ); + Assert.assertEquals( "name", a.getName() ); + Assert.assertEquals( BigInteger.valueOf( -100L ), a.getNegativeInteger() ); + Assert.assertEquals( BigInteger.TEN, a.getNonNegativeInteger() ); + Assert.assertEquals( BigInteger.valueOf( -100L ), a.getNonPositiveInteger() ); + Assert.assertEquals( "normalized", a.getNormalizedString() ); + Assert.assertEquals( BigInteger.TEN, a.getPositiveInteger() ); + Assert.assertEquals( this.getTestQName(), a.getQName() ); + Assert.assertEquals( 100, a.getShort() ); + Assert.assertEquals( "String", a.getString() ); + Assert.assertEquals( this.getTestCalendar(), a.getTime() ); + Assert.assertEquals( "Token", a.getToken() ); + Assert.assertEquals( 100, a.getUnsignedByte() ); + Assert.assertEquals( 100, a.getUnsignedInt() ); + Assert.assertEquals( BigInteger.TEN, a.getUnsignedLong() ); + Assert.assertEquals( 100, a.getUnsignedShort() ); + } + + public void testSimpleTypeAttributesNull() throws Exception + { + new SimpleTypeAttributes( null ); + } + + public void testSimpleTypeAttributesDefaults() throws Exception + { + new SimpleTypeAttributes( new SimpleTypeAttributes() ); + } + + public void testSimpleTypeAttributes() throws Exception + { + this.assertTestSimpleTypeAttributes( new SimpleTypeAttributes( this.getTestSimpleTypeAttributes() ) ); + } + + public void testSerializable() throws Exception + { + final int runs = 100000; + + System.gc(); + System.gc(); + System.gc(); + + final SimpleTypeAttributes a = this.getTestSimpleTypeAttributes(); + + long start = System.currentTimeMillis(); + for ( int i = runs; i >= 0; i-- ) + { + this.assertTestSimpleTypeAttributes( (SimpleTypeAttributes) SerializationUtils.clone( a ) ); + } + final long serializableMillis = System.currentTimeMillis() - start; + + System.gc(); + System.gc(); + System.gc(); + + start = System.currentTimeMillis(); + for ( int i = runs; i >= 0; i-- ) + { + this.assertTestSimpleTypeAttributes( new SimpleTypeAttributes( a ) ); + } + final long copyMillis = System.currentTimeMillis() - start; + + System.gc(); + System.gc(); + System.gc(); + + System.out.println( "Creating " + runs + " copies using serialization took " + serializableMillis + + "ms. (100%)" ); + + System.out.println( "Creating " + runs + " copies using copy constructor took " + copyMillis + "ms. (" + + ( 100L * copyMillis / serializableMillis ) + "%)" ); + + Assert.assertTrue( copyMillis < serializableMillis ); + } + +} Property changes on: trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java =================================================================== --- trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java (rev 0) +++ trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java 2009-08-16 01:12:03 UTC (rev 52) @@ -0,0 +1,334 @@ +/* + * 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: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * o 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. + * + * $Id$ + */ +package net.sourceforge.ccxjc.it; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.Duration; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; +import junit.framework.Assert; +import net.sourceforge.ccxjc.it.model.priv.indexed.valueclass.ccxjcit.SimpleTypeAttributes; +import org.apache.commons.lang.SerializationUtils; + +/** + * Tests the {@code SimpleTypeAttributes} complex type. + * + * @author <a href="mailto:cs...@sc...">Christian Schulte</a> + * @version $Id$ + */ +public class SimpleTypeAttributesIndexedTest +{ + + private static final String CCXJC_NS = "http://sourceforge.net/ccxjc/it"; + + private XMLGregorianCalendar testCalendar; + + private Duration testDuration; + + private byte[] testBytes; + + private String[] testEntities; + + private Object[] testIdRefs; + + private String[] testTokens; + + private QName testQName; + + public XMLGregorianCalendar getTestCalendar() throws DatatypeConfigurationException + { + if ( this.testCalendar == null ) + { + this.testCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(); + } + + return this.testCalendar; + } + + public Duration getTestDuration() throws DatatypeConfigurationException + { + if ( this.testDuration == null ) + { + this.testDuration = DatatypeFactory.newInstance().newDuration( 1000L ); + } + + return this.testDuration; + } + + public byte[] getTestBytes() + { + if ( this.testBytes == null ) + { + this.testBytes = new byte[ 256 ]; + for ( int i = 255; i >= 0; i-- ) + { + this.testBytes[i] = (byte) i; + } + } + + return this.testBytes; + } + + public String[] getTestEntities() + { + if ( this.testEntities == null ) + { + this.testEntities = new String[] + { + "ENTITY 1", "ENTITY 2", "ENTITY 3" + }; + + } + + return this.testEntities; + } + + public Object[] getTestIdRefs() + { + if ( this.testIdRefs == null ) + { + this.testIdRefs = new Object[] + { + "ID" + }; + + } + + return this.testIdRefs; + } + + public String[] getTestTokens() + { + if ( this.testTokens == null ) + { + this.testTokens = new String[] + { + "NMTOKEN 1", "NMTOKEN 2", "NMTOKEN 3" + }; + + } + + return this.testTokens; + } + + public QName getTestQName() + { + if ( this.testQName == null ) + { + this.testQName = new QName( CCXJC_NS, "ID" ); + } + + return this.testQName; + } + + public void assertTestBytes( final byte[] bytes ) + { + Assert.assertTrue( Arrays.equals( this.getTestBytes(), bytes ) ); + } + + public void assertTestEntities( final String[] entities ) + { + Assert.assertTrue( Arrays.equals( this.getTestEntities(), entities ) ); + } + + public void assertTestIdRefs( final Object[] idrefs ) + { + Assert.assertTrue( Arrays.equals( this.getTestIdRefs(), idrefs ) ); + } + + public void assertTestTokens( final String[] tokens ) + { + Assert.assertTrue( Arrays.equals( this.getTestTokens(), tokens ) ); + } + + public SimpleTypeAttributes getTestSimpleTypeAttributes() throws DatatypeConfigurationException + { + final SimpleTypeAttributes t = new SimpleTypeAttributes(); + + t.setAnySimpleType( "any" ); + t.setAnyURI( "anyURI" ); + t.setBase64Binary( this.getTestBytes() ); + t.setBoolean( true ); + t.setByte( (byte) 1 ); + t.setDate( this.getTestCalendar() ); + t.setDateTime( this.getTestCalendar() ); + t.setDecimal( BigDecimal.TEN ); + t.setDouble( 100.0D ); + t.setDuration( this.getTestDuration() ); + t.setENTITY( "ENTITY" ); + t.setFloat( 100.0F ); + t.setGDay( this.getTestCalendar() ); + t.setGMonth( this.getTestCalendar() ); + t.setGMonthDay( this.getTestCalendar() ); + t.setGYear( this.getTestCalendar() ); + t.setGYearMonth( this.getTestCalendar() ); + t.setHexBinary( this.getTestBytes() ); + t.setID( "ID" ); + t.setIDREF( "ID" ); + t.setInt( 100 ); + t.setInteger( BigInteger.TEN ); + t.setLanguage( "en" ); + t.setLong( 100L ); + t.setNCName( "NCName" ); + t.setNMTOKEN( "NMTOKEN" ); + t.setNOTATION( this.getTestQName() ); + t.setName( "name" ); + t.setNegativeInteger( BigInteger.valueOf( -100L ) ); + t.setNonNegativeInteger( BigInteger.TEN ); + t.setNonPositiveInteger( BigInteger.valueOf( -100L ) ); + t.setNormalizedString( "normalized" ); + t.setPositiveInteger( BigInteger.TEN ); + t.setQName( this.getTestQName() ); + t.setShort( (short) 100 ); + t.setString( "String" ); + t.setTime( DatatypeFactory.newInstance().newXMLGregorianCalendar() ); + t.setToken( "Token" ); + t.setUnsignedByte( (short) 100 ); + t.setUnsignedInt( 100L ); + t.setUnsignedLong( BigInteger.TEN ); + t.setUnsignedShort( 100 ); + + t.setENTITIES( this.getTestEntities() ); + t.setIDREFS( this.getTestIdRefs() ); + t.setNMTOKENS( this.getTestTokens() ); + + return t; + } + + public void assertTestSimpleTypeAttributes( final SimpleTypeAttributes a ) throws DatatypeConfigurationException + { + Assert.assertEquals( "any", a.getAnySimpleType() ); + Assert.assertEquals( "anyURI", a.getAnyURI() ); + this.assertTestBytes( a.getBase64Binary() ); + Assert.assertEquals( true, a.isBoolean() ); + Assert.assertEquals( 1, a.getByte() ); + Assert.assertEquals( this.getTestCalendar(), a.getDate() ); + Assert.assertEquals( this.getTestCalendar(), a.getDateTime() ); + Assert.assertEquals( BigDecimal.TEN, a.getDecimal() ); + Assert.assertEquals( 100.0D, a.getDouble() ); + Assert.assertEquals( this.getTestDuration(), a.getDuration() ); + this.assertTestEntities( a.getENTITIES() ); + Assert.assertEquals( "ENTITY", a.getENTITY() ); + Assert.assertEquals( 100.0F, a.getFloat() ); + Assert.assertEquals( this.getTestCalendar(), a.getGDay() ); + Assert.assertEquals( this.getTestCalendar(), a.getGMonth() ); + Assert.assertEquals( this.getTestCalendar(), a.getGMonthDay() ); + Assert.assertEquals( this.getTestCalendar(), a.getGYear() ); + Assert.assertEquals( this.getTestCalendar(), a.getGYearMonth() ); + this.assertTestBytes( a.getHexBinary() ); + Assert.assertEquals( "ID", a.getID() ); + Assert.assertEquals( "ID", a.getIDREF() ); + this.assertTestIdRefs( a.getIDREFS() ); + Assert.assertEquals( 100, a.getInt() ); + Assert.assertEquals( BigInteger.TEN, a.getInteger() ); + Assert.assertEquals( "en", a.getLanguage() ); + Assert.assertEquals( 100L, a.getLong() ); + Assert.assertEquals( "NCName", a.getNCName() ); + Assert.assertEquals( "NMTOKEN", a.getNMTOKEN() ); + this.assertTestTokens( a.getNMTOKENS() ); + Assert.assertEquals( this.getTestQName(), a.getNOTATION() ); + Assert.assertEquals( "name", a.getName() ); + Assert.assertEquals( BigInteger.valueOf( -100L ), a.getNegativeInteger() ); + Assert.assertEquals( BigInteger.TEN, a.getNonNegativeInteger() ); + Assert.assertEquals( BigInteger.valueOf( -100L ), a.getNonPositiveInteger() ); + Assert.assertEquals( "normalized", a.getNormalizedString() ); + Assert.assertEquals( BigInteger.TEN, a.getPositiveInteger() ); + Assert.assertEquals( this.getTestQName(), a.getQName() ); + Assert.assertEquals( 100, a.getShort() ); + Assert.assertEquals( "String", a.getString() ); + Assert.assertEquals( this.getTestCalendar(), a.getTime() ); + Assert.assertEquals( "Token", a.getToken() ); + Assert.assertEquals( 100, a.getUnsignedByte() ); + Assert.assertEquals( 100, a.getUnsignedInt() ); + Assert.assertEquals( BigInteger.TEN, a.getUnsignedLong() ); + Assert.assertEquals( 100, a.getUnsignedShort() ); + } + + public void testSimpleTypeAttributesNull() throws Exception + { + new SimpleTypeAttributes( null ); + } + + public void testSimpleTypeAttributesDefaults() throws Exception + { + new SimpleTypeAttributes( new SimpleTypeAttributes() ); + } + + public void testSimpleTypeAttributes() throws Exception + { + this.assertTestSimpleTypeAttributes( new SimpleTypeAttributes( this.getTestSimpleTypeAttributes() ) ); + } + + public void testSerializable() throws Exception + { + final int runs = 100000; + + System.gc(); + System.gc(); + System.gc(); + + final SimpleTypeAttributes a = this.getTestSimpleTypeAttributes(); + long start = System.currentTimeMillis(); + for ( int i = runs; i >= 0; i-- ) + { + this.assertTestSimpleTypeAttributes( (SimpleTypeAttributes) SerializationUtils.clone( a ) ); + } + final long serializableMillis = System.currentTimeMillis() - start; + + System.gc(); + System.gc(); + System.gc(); + + start = System.currentTimeMillis(); + for ( int i = runs; i >= 0; i-- ) + { + this.assertTestSimpleTypeAttributes( new SimpleTypeAttributes( a ) ); + } + final long copyMillis = System.currentTimeMillis() - start; + + System.gc(); + System.gc(); + System.gc(); + + System.out.println( "Creating " + runs + " copies using serialization took " + serializableMillis + + "ms. (100%)" ); + + System.out.println( "Creating " + runs + " copies using copy constructor took " + copyMillis + "ms. (" + + ( 100L * copyMillis / serializableMillis ) + "%)" ); + + Assert.assertTrue( copyMillis < serializableMillis ); + } + +} Property changes on: trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Added: trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-package.xjb =================================================================== --- trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-package.xjb (rev 0) +++ trunk/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-package.xjb 2009-08-16 01:12:03 UTC (rev 52) @@ -0,0 +1,259 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + + $Id$ + +--> +<jaxb:bindings xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" + xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + jaxb:version="2.0"> + + <jaxb:globalBindings generateValueClass="false"> + <jaxb:serializable uid="1"/> + </jaxb:globalBindings> + + <jaxb:bindings schemaLocation="../schemas/cc-xjc-it.xsd"> + <jaxb:schemaBindings> + <jaxb:package name="net.sourceforge.ccxjc.it.model.pkg.collections.novalueclass.ccxjcit"/> + </jaxb:schemaBindings> + </jaxb:bindings> + + <jaxb:bindings schemaLocation="../schemas/javaee_5.xsd"> + <jaxb:schemaBindings> + <jaxb:package name="net.sourceforge.ccxjc.it.model.pkg.collections.novalueclass.javaee"/> + </jaxb:schemaBindings> + </jaxb:bindings> + + <jaxb:bindings schemaLocation="../schemas/persistence_1_0.xsd"> + <jaxb:schemaBindings> + <jaxb:package name="net.sourceforge.ccxjc.it.model.pkg.collections.novalueclass.persistence"/> + </jaxb:schemaBindings> + </jaxb:bindings> + + <jaxb:bindings schemaLocation="../schemas/orm_1_0.xsd"> + <jaxb:schemaBindings> + <jaxb:package name="net.sourceforge.ccxjc.it.model.pkg.collections.novalueclass.persistence.orm"/> + </jaxb:schemaBindings> + </jaxb:bindings> + + <jaxb:bindings schemaLocation="../schemas/spring-beans-2.5.xsd"> + <jaxb:schemaBindings> + <jaxb:package name="net.sourceforge.ccxjc.it.model.pkg.collections.novalueclass.spring.beans"/> + </jaxb:schemaBindings> + <jaxb:bindings node="xs:element[@name='constructor-arg']/xs:complexType/xs:attribute[@name='ref']"> + <jaxb:property name="refShortcut"/> + </jaxb:bindings> + <jaxb:bindings node="xs:element[@name='constructor-arg']/xs:complexType/xs:attribute[@name='value']"> + <jaxb:property name="valueShortcut"/> + </jaxb:bindings> + <jaxb:bindings node="xs:complexType[@name='propertyType']/xs:attribute[@name='ref']"> + <jaxb:property name="refShortcut"/> + </jaxb:bindings> + <jaxb:bindings node="xs:complexType[@name='propertyType']/xs:attribute[@name='value']"> + <jaxb:property name="valueShortcut"/> + </jaxb:bindings> + <jaxb:bindings node="xs:complexType[@name='entryType']/xs:sequence/xs:ele... [truncated message content] |
From: <sch...@us...> - 2009-08-16 02:39:32
|
Revision: 55 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=55&view=rev Author: schulte2005 Date: 2009-08-16 02:39:24 +0000 (Sun, 16 Aug 2009) Log Message: ----------- o Added LICENSE.txt and README.xhtml to META-INF directory. Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-plugin/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-16 02:30:31 UTC (rev 54) +++ trunk/cc-xjc-dist/pom.xml 2009-08-16 02:39:24 UTC (rev 55) @@ -54,7 +54,6 @@ <goal>copy</goal> </goals> <configuration> - <outputDirectory>${project.build.directory}/artifacts</outputDirectory> <artifactItems> <artifactItem> <groupId>${pom.groupId}</groupId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-16 02:30:31 UTC (rev 54) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-16 02:39:24 UTC (rev 55) @@ -40,10 +40,7 @@ <artifactId>cc-xjc-plugin</artifactId> <packaging>jar</packaging> <name>CC-XJC Plugin</name> - <description><![CDATA[ - JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to - schema derived classes.]]> - </description> + <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <build> <resources> <resource> @@ -65,6 +62,39 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>validate</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${pom.groupId}</groupId> + <artifactId>cc-xjc</artifactId> + <version>${pom.version}</version> + <type>xhtml</type> + <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory> + <destFileName>README.xhtml</destFileName> + </artifactItem> + <artifactItem> + <groupId>${pom.groupId}</groupId> + <artifactId>cc-xjc</artifactId> + <version>${pom.version}</version> + <type>lic</type> + <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory> + <destFileName>LICENSE.txt</destFileName> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> <dependencies> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-16 03:03:20
|
Revision: 56 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=56&view=rev Author: schulte2005 Date: 2009-08-16 03:03:08 +0000 (Sun, 16 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare release cc-xjc-1.0-beta-7 Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-16 02:39:24 UTC (rev 55) +++ trunk/cc-xjc-dist/pom.xml 2009-08-16 03:03:08 UTC (rev 56) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-7-SNAPSHOT</version> + <version>1.0-beta-7</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-16 02:39:24 UTC (rev 55) +++ trunk/cc-xjc-it/pom.xml 2009-08-16 03:03:08 UTC (rev 56) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-7-SNAPSHOT</version> + <version>1.0-beta-7</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-16 02:39:24 UTC (rev 55) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-16 03:03:08 UTC (rev 56) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-7-SNAPSHOT</version> + <version>1.0-beta-7</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-16 02:39:24 UTC (rev 55) +++ trunk/pom.xml 2009-08-16 03:03:08 UTC (rev 56) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-7-SNAPSHOT</version> + <version>1.0-beta-7</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-7</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-7</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-7</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-16 03:03:55
|
Revision: 58 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=58&view=rev Author: schulte2005 Date: 2009-08-16 03:03:45 +0000 (Sun, 16 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-16 03:03:32 UTC (rev 57) +++ trunk/cc-xjc-dist/pom.xml 2009-08-16 03:03:45 UTC (rev 58) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-7</version> + <version>1.0-beta-8-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-16 03:03:32 UTC (rev 57) +++ trunk/cc-xjc-it/pom.xml 2009-08-16 03:03:45 UTC (rev 58) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-7</version> + <version>1.0-beta-8-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-16 03:03:32 UTC (rev 57) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-16 03:03:45 UTC (rev 58) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-7</version> + <version>1.0-beta-8-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-16 03:03:32 UTC (rev 57) +++ trunk/pom.xml 2009-08-16 03:03:45 UTC (rev 58) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-7</version> + <version>1.0-beta-8-SNAPSHOT</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-7</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-7</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-7</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-16 12:25:43
|
Revision: 61 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=61&view=rev Author: schulte2005 Date: 2009-08-16 12:25:37 +0000 (Sun, 16 Aug 2009) Log Message: ----------- o Corrected an IllegalArgumentException thrown by generated copyObject methods. o Removed generated copyOfQName methods and added QName to the list of immutable types. o Added support for @XmlAnyAttribute. o Added -cc-target option. Modified Paths: -------------- trunk/cc-xjc-it/pom.xml trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties trunk/src/main/changes/changes.xml trunk/src/site/apt/download.apt trunk/src/site/apt/examples.apt trunk/src/site/apt/index.apt Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/cc-xjc-it/pom.xml 2009-08-16 12:25:37 UTC (rev 61) @@ -57,6 +57,39 @@ </executions> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>validate</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${pom.groupId}</groupId> + <artifactId>cc-xjc</artifactId> + <version>${pom.version}</version> + <type>xhtml</type> + <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory> + <destFileName>README.xhtml</destFileName> + </artifactItem> + <artifactItem> + <groupId>${pom.groupId}</groupId> + <artifactId>cc-xjc</artifactId> + <version>${pom.version}</version> + <type>lic</type> + <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory> + <destFileName>LICENSE.txt</destFileName> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <executions> Modified: trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd =================================================================== (Binary files differ) Modified: trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-16 12:25:37 UTC (rev 61) @@ -42,6 +42,7 @@ import com.sun.codemodel.JInvocation; import com.sun.codemodel.JMethod; import com.sun.codemodel.JMod; +import com.sun.codemodel.JOp; import com.sun.codemodel.JTryBlock; import com.sun.codemodel.JType; import com.sun.codemodel.JVar; @@ -78,7 +79,6 @@ import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.namespace.QName; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; @@ -110,6 +110,8 @@ private static final String VISIBILITY_OPTION_NAME = "-cc-visibility"; + private static final String TARGET_OPTION_NAME = "-cc-target"; + private static final String[] IMMUTABLE_NAMES = { "java.lang.Boolean", @@ -124,7 +126,8 @@ "java.lang.String", "java.math.BigDecimal", "java.math.BigInteger", - "java.util.UUID" + "java.util.UUID", + "javax.xml.namespace.QName" }; private static final String[] VISIBILITY_ARGUMENTS = @@ -132,12 +135,25 @@ "private", "package", "protected", "public" }; + private static final String[] TARGET_ARGUMENTS = + { + "1.5", "1.6", "1.7" + }; + + private static final int TARGET_1_5 = 5; + + private static final int TARGET_1_6 = 6; + + private static final int TARGET_1_7 = 7; + private boolean success; private Options options; private String visibility = "package"; + private int target = TARGET_1_5; + private BigInteger methodCount; private BigInteger constructorCount; @@ -160,23 +176,33 @@ public int parseArgument( final Options opt, final String[] args, final int i ) throws BadCommandLineException, IOException { - final StringBuffer supportedArguments = new StringBuffer().append( '[' ); + final StringBuffer supportedVisibilities = new StringBuffer().append( '[' ); for ( Iterator<String> it = Arrays.asList( VISIBILITY_ARGUMENTS ).iterator(); it.hasNext(); ) { - supportedArguments.append( it.next() ); + supportedVisibilities.append( it.next() ); if ( it.hasNext() ) { - supportedArguments.append( ", " ); + supportedVisibilities.append( ", " ); } } + final StringBuffer supportedTargets = new StringBuffer().append( '[' ); + for ( Iterator<String> it = Arrays.asList( TARGET_ARGUMENTS ).iterator(); it.hasNext(); ) + { + supportedTargets.append( it.next() ); + if ( it.hasNext() ) + { + supportedTargets.append( ", " ); + } + } + if ( args[i].startsWith( VISIBILITY_OPTION_NAME ) ) { if ( i + 1 >= args.length ) { - throw new BadCommandLineException( this.getMessage( "badVisibilityOption", new Object[] + throw new BadCommandLineException( this.getMessage( "badOption", new Object[] { - VISIBILITY_OPTION_NAME, supportedArguments.append( ']' ).toString() + VISIBILITY_OPTION_NAME, supportedVisibilities.append( ']' ).toString() } ) ); } @@ -195,9 +221,9 @@ if ( !supported ) { - throw new BadCommandLineException( this.getMessage( "badVisibilityOption", new Object[] + throw new BadCommandLineException( this.getMessage( "badOption", new Object[] { - VISIBILITY_OPTION_NAME, supportedArguments.append( ']' ).toString() + VISIBILITY_OPTION_NAME, supportedVisibilities.append( ']' ).toString() } ) ); } @@ -205,6 +231,54 @@ return 2; } + if ( args[i].startsWith( TARGET_OPTION_NAME ) ) + { + if ( i + 1 >= args.length ) + { + throw new BadCommandLineException( this.getMessage( "badOption", new Object[] + { + TARGET_OPTION_NAME, supportedTargets.append( ']' ).toString() + } ) ); + + } + + final String targetArg = args[i + 1].trim(); + + boolean supported = false; + for ( String argument : TARGET_ARGUMENTS ) + { + if ( argument.equals( targetArg ) ) + { + supported = true; + break; + } + } + + if ( !supported ) + { + throw new BadCommandLineException( this.getMessage( "badOption", new Object[] + { + TARGET_OPTION_NAME, supportedTargets.append( ']' ).toString() + } ) ); + + } + + if ( targetArg.equals( "1.5" ) ) + { + this.target = TARGET_1_5; + } + else if ( targetArg.equals( "1.6" ) ) + { + this.target = TARGET_1_6; + } + else if ( targetArg.equals( "1.7" ) ) + { + this.target = TARGET_1_7; + } + + return 2; + } + return 0; } @@ -280,6 +354,11 @@ return JMod.NONE; } + private boolean isTargetSupported( final int target ) + { + return target <= this.target; + } + private JMethod getStandardConstructor( final ClassOutline clazz ) { JMethod ctor = clazz.implClass.getConstructor( NO_ARGS ); @@ -411,7 +490,7 @@ { noObjectsField = clazz._package().objectFactory().field( JMod.PRIVATE | JMod.STATIC | JMod.FINAL, Object[].class, NO_OBJECTS_FIELDNAME, - JExpr.newArray( clazz.parent().getCodeModel().ref( Class.class ), 0 ) ); + JExpr.newArray( clazz.parent().getCodeModel().ref( Object.class ), 0 ) ); } } @@ -422,7 +501,7 @@ { noObjectsField = clazz.implClass.field( JMod.PRIVATE | JMod.STATIC | JMod.FINAL, Object[].class, NO_OBJECTS_FIELDNAME, - JExpr.newArray( clazz.parent().getCodeModel().ref( Class.class ), 0 ) ); + JExpr.newArray( clazz.parent().getCodeModel().ref( Object.class ), 0 ) ); } } @@ -477,6 +556,7 @@ } m.body()._return( JExpr.FALSE ); + this.methodCount = this.methodCount.add( BigInteger.ONE ); return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } @@ -698,62 +778,6 @@ return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } - private JInvocation getCopyOfQNameInvocation( final ClassOutline clazz ) - { - final JClass qnameClass = clazz.parent().getCodeModel().ref( QName.class ); - final JType[] signature = - { - qnameClass - }; - - final String methodName = "copyOfQName"; - final int mod = this.getVisibilityModifier(); - - if ( mod != JMod.PRIVATE ) - { - for ( JMethod m : clazz._package().objectFactory().methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return clazz._package().objectFactory().staticInvoke( m ); - } - } - } - else - { - for ( JMethod m : clazz.implClass.methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return JExpr.invoke( m ); - } - } - } - - final JMethod m = - ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, QName.class, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, QName.class, methodName ) ); - - final JVar qName = m.param( JMod.FINAL, qnameClass, "qName" ); - - m.javadoc().append( "Creates and returns a copy of a given {@code QName} instance." ); - m.javadoc().addParam( qName ).append( "The instance to copy or {@code null}." ); - m.javadoc().addReturn().append( "A copy of {@code qName} or {@code null} if {@code qName} is {@code null}." ); - - m.body().directStatement( "// " + this.getMessage( "title", null ) ); - - final JConditional ifNotNull = m.body()._if( qName.ne( JExpr._null() ) ); - ifNotNull._then()._return( JExpr._new( qnameClass ). - arg( JExpr.invoke( qName, "getNamespaceURI" ) ). - arg( JExpr.invoke( qName, "getLocalPart" ) ). - arg( JExpr.invoke( qName, "getPrefix" ) ) ); - - m.body()._return( JExpr._null() ); - this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); - } - private JInvocation getCopyOfXMLGregorianCalendarInvocation( final ClassOutline clazz ) { final JClass xmlGregorianCalendar = clazz.parent().getCodeModel().ref( XMLGregorianCalendar.class ); @@ -880,6 +904,9 @@ final JClass noSuchMethod = clazz.parent().getCodeModel().ref( NoSuchMethodException.class ); final JClass illegalAccess = clazz.parent().getCodeModel().ref( IllegalAccessException.class ); final JClass invocationTarget = clazz.parent().getCodeModel().ref( InvocationTargetException.class ); + final JClass securityException = clazz.parent().getCodeModel().ref( SecurityException.class ); + final JClass illegalArgument = clazz.parent().getCodeModel().ref( IllegalArgumentException.class ); + final JClass initializerError = clazz.parent().getCodeModel().ref( ExceptionInInitializerError.class ); final JClass assertionError = clazz.parent().getCodeModel().ref( AssertionError.class ); final String methodName = "copyOfObject"; @@ -946,7 +973,8 @@ final JTryBlock tryCloneMethod = objectNotNull._then()._try(); tryCloneMethod.body()._return( JExpr.invoke( JExpr.invoke( JExpr.invoke( o, "getClass" ), "getMethod" ). - arg( "clone" ).arg( this.getNoClassesField( clazz ) ), "invoke" ).arg( this.getNoObjectsField( clazz ) ) ); + arg( "clone" ).arg( this.getNoClassesField( clazz ) ), "invoke" ).arg( o ). + arg( this.getNoObjectsField( clazz ) ) ); final JExpression assertionErrorMsg = JExpr.lit( "Unexpected instance during copying object '" ).plus( o ).plus( JExpr.lit( "'." ) ); @@ -972,6 +1000,27 @@ catchInvocationTarget.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchInvocationTarget.param( "e" ) ) ) ); + final JCatchBlock catchSecurityException = tryCloneMethod._catch( securityException ); + catchSecurityException.body().directStatement( "// Please report this at " + + this.getMessage( "bugtrackerUrl", null ) ); + + catchSecurityException.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchSecurityException.param( "e" ) ) ) ); + + final JCatchBlock catchIllegalArgument = tryCloneMethod._catch( illegalArgument ); + catchIllegalArgument.body().directStatement( "// Please report this at " + + this.getMessage( "bugtrackerUrl", null ) ); + + catchIllegalArgument.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchIllegalArgument.param( "e" ) ) ) ); + + final JCatchBlock catchInitializerError = tryCloneMethod._catch( initializerError ); + catchInitializerError.body().directStatement( "// Please report this at " + + this.getMessage( "bugtrackerUrl", null ) ); + + catchInitializerError.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchInitializerError.param( "e" ) ) ) ); + m.body()._return( JExpr._null() ); this.methodCount = this.methodCount.add( BigInteger.ONE ); return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); @@ -1028,7 +1077,7 @@ return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } - private JInvocation getCopyOfClassInfoElementInvocation( final ClassOutline clazz, final CTypeInfo type ) + private JInvocation getCopyOfClassInfoElementInvocation( final ClassOutline clazz, final CNonElement type ) { final JType jaxbElement = clazz.parent().getCodeModel().ref( JAXBElement.class ); final JType javaType = type.toType( clazz.parent(), Aspect.IMPLEMENTATION ); @@ -1477,8 +1526,18 @@ } else if ( type == CBuiltinLeafInfo.BASE64_BYTE_ARRAY ) { - final JType byteArray = classOutline.parent().getCodeModel().ref( byte[].class ); - expr = JExpr.cast( byteArray, this.getCopyOfArrayInvocation( classOutline ).arg( source ) ); + if ( this.isTargetSupported( TARGET_1_6 ) ) + { + final JClass arrays = classOutline.parent().getCodeModel().ref( Arrays.class ); + expr = JOp.cond( source.eq( JExpr._null() ), JExpr._null(), arrays.staticInvoke( "copyOf" ). + arg( source ).arg( source.ref( "length" ) ) ); + + } + else + { + final JType byteArray = classOutline.parent().getCodeModel().ref( byte[].class ); + expr = JExpr.cast( byteArray, this.getCopyOfArrayInvocation( classOutline ).arg( source ) ); + } } else if ( type == CBuiltinLeafInfo.BIG_DECIMAL || type == CBuiltinLeafInfo.BIG_INTEGER || type == CBuiltinLeafInfo.STRING || type == CBuiltinLeafInfo.BOOLEAN || type == CBuiltinLeafInfo.INT || @@ -1489,7 +1548,7 @@ } else if ( type == CBuiltinLeafInfo.QNAME ) { - expr = this.getCopyOfQNameInvocation( classOutline ).arg( source ); + expr = source; } else if ( type == CBuiltinLeafInfo.CALENDAR ) { @@ -1619,9 +1678,18 @@ } else { - paramNotNullBlock.assign( JExpr.refthis( field.name() ), JExpr.cast( - field.type(), this.getCopyOfObjectInvocation( clazz ).arg( o.ref( field ) ) ) ); + if ( field.name().equals( "otherAttributes" ) && clazz.target.declaresAttributeWildcard() ) + { + paramNotNullBlock.add( + JExpr.refthis( field.name() ).invoke( "putAll" ).arg( o.ref( field ) ) ); + } + else + { + paramNotNullBlock.assign( JExpr.refthis( field.name() ), JExpr.cast( + field.type(), this.getCopyOfObjectInvocation( clazz ).arg( o.ref( field ) ) ) ); + + } } } } Modified: trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties =================================================================== --- trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-08-16 12:25:37 UTC (rev 61) @@ -12,5 +12,5 @@ title=CC-XJC Version ${pom.version} Build ${buildNumber} bugtrackerUrl=https://apps.sourceforge.net/mantisbt/ccxjc/ report={0,number} methods - {1,number} constructors - {2,number} expressions -badVisibilityOption=Missing argument to {0} option. Expected one of {1}. +badOption=Missing argument to {0} option. Expected one of {1}. visibilityReport=Creating methods using ''{0}'' visibility. Modified: trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties =================================================================== --- trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-08-16 12:25:37 UTC (rev 61) @@ -12,5 +12,5 @@ title=CC-XJC Version ${pom.version} Build ${buildNumber} bugtrackerUrl=https://apps.sourceforge.net/mantisbt/ccxjc/ report={0,number} Methoden - {1,number} Konstruktoren - {2,number} Ausdr\u00FCcke -badVisibilityOption={0} Option erwartet {1} Argument. +badOption={0} Option erwartet {1} Argument. visibilityReport=Erstellt Methoden mit ''{0}'' Sichtbarkeit. Modified: trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties =================================================================== --- trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-08-16 12:25:37 UTC (rev 61) @@ -12,5 +12,5 @@ title=CC-XJC Version ${pom.version} Build ${buildNumber} bugtrackerUrl=https://apps.sourceforge.net/mantisbt/ccxjc/ report={0,number} methods - {1,number} constructors - {2,number} expressions -badVisibilityOption=Missing argument to {0} option. Expected one of {1}. +badOption=Missing argument to {0} option. Expected one of {1}. visibilityReport=Creating methods using ''{0}'' visibility. Modified: trunk/src/main/changes/changes.xml =================================================================== --- trunk/src/main/changes/changes.xml 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/src/main/changes/changes.xml 2009-08-16 12:25:37 UTC (rev 61) @@ -83,13 +83,34 @@ </release> <!-- ******************************************************************* --> - <release version="1.0-beta-7" date="2009-08-18"> - <action dev="schulte2005" type="fix"> + <release version="1.0-beta-7" date="2009-08-16"> + <action dev="schulte2005" type="fix"><![CDATA[ Added support for various property types not supported prior to this version (collectionType=&indexed&, - generateValueClass=&false&, etc.). + generateValueClass=&false&, etc.).]]> </action> + <action dev="schulte2005" type="update"><![CDATA[ + Added <code>-cc-visibility</code> option.]]> + </action> </release> + <!-- ******************************************************************* --> + <release version="1.0-beta-8" date="2009-08-18"> + <action dev="schulte2005" type="fix"><![CDATA[ + Corrected an <code>IllegalArgumentException</code> thrown by + generated <code>copyObject</code> methods.]]> + </action> + <action dev="schulte2005" type="update"><![CDATA[ + Removed generated <code>copyOfQName</code> methods and added + <code>QName</code> to the list of immutable types.]]> + </action> + <action dev="schulte2005" type="update"><![CDATA[ + Added support for <code>@XmlAnyAttribute</code>.]]> + </action> + <action dev="schulte2005" type="update"><![CDATA[ + Added <code>-cc-target</code> option.]]> + </action> + </release> + </body> </document> Modified: trunk/src/site/apt/download.apt =================================================================== --- trunk/src/site/apt/download.apt 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/src/site/apt/download.apt 2009-08-16 12:25:37 UTC (rev 61) @@ -39,11 +39,24 @@ * Releases - Releases are deployed to the Sourceforge file release system. Please see the - {{{https://sourceforge.net/project/showfiles.php?group_id=260900}Sourceforge FRS}}. - The {{{http://ccxjc.sourceforge.net/changes-report.html}changes report}} - contains information regarding changes between releases. + Releases are deployed to the CC-XJC release repository and to the + {{{http://sourceforge.net/projects/ccxjc/files/}Sourceforge file release system}}. + The {{{http://ccxjc.sourceforge.net/changes-report.html}changes report}} contains + information regarding changes between releases. +--- +<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> +--- + * Snapshots Development snapshots are deployed to the CC-XJC snapshot repository and Modified: trunk/src/site/apt/examples.apt =================================================================== --- trunk/src/site/apt/examples.apt 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/src/site/apt/examples.apt 2009-08-16 12:25:37 UTC (rev 61) @@ -68,7 +68,7 @@ <dependency> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc-plugin</artifactId> - <version>1.0-beta-7</version> + <version>1.0-beta-8</version> </dependency> </dependencies> <executions> @@ -80,7 +80,7 @@ </goals> <configuration> <schemaDirectory>src/main/schemas</schemaDirectory> - <args>-copy-constructor -cc-visibility private</args> + <args>-copy-constructor -cc-visibility private -cc-target 1.6</args> <extension>true</extension> </configuration> </execution> Modified: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt 2009-08-16 10:04:28 UTC (rev 60) +++ trunk/src/site/apt/index.apt 2009-08-16 12:25:37 UTC (rev 61) @@ -41,12 +41,24 @@ 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. + enabled by adding its jar file to the XJC classpath. When enabled, the + following options can be used to control the behavior of the plugin. + * -cc-visibility + + The '-cc-visibility' option can be used to specify the visibility of + generated helper methods. It takes one argument from the list + [private, package, protected, public]. This option impacts the number of + generated helper methods. Default: package. + + * -cc-target + + The '-cc-target' option can be used to specify a target JDK version for the + generated code. It takes one argument from the list [1.5, 1.6, 1.7]. + Default: 1.5. + + See the examples for further information. + * Support Development of CC-XJC is community driven. Please file any issues with the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-17 08:10:23
|
Revision: 62 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=62&view=rev Author: schulte2005 Date: 2009-08-17 08:10:04 +0000 (Mon, 17 Aug 2009) Log Message: ----------- o Removed generated copyOfDuration methods and added Duration to the list of immutable types. o Added various tests. Modified Paths: -------------- trunk/cc-xjc-it/pom.xml trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/pom.xml trunk/src/main/changes/changes.xml Added Paths: ----------- trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java trunk/cc-xjc-it/src/main/resources/ trunk/cc-xjc-it/src/main/resources/net/ trunk/cc-xjc-it/src/main/resources/net/sourceforge/ trunk/cc-xjc-it/src/main/resources/net/sourceforge/ccxjc/ trunk/cc-xjc-it/src/main/resources/net/sourceforge/ccxjc/it/ trunk/cc-xjc-it/src/main/resources/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.xml Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-16 12:25:37 UTC (rev 61) +++ trunk/cc-xjc-it/pom.xml 2009-08-17 08:10:04 UTC (rev 62) @@ -105,6 +105,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>private</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -127,6 +131,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>private</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -149,6 +157,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>private</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -171,6 +183,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>private</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -192,6 +208,10 @@ <configuration> <args> <arg>-copy-constructor</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -212,6 +232,10 @@ <configuration> <args> <arg>-copy-constructor</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -232,6 +256,10 @@ <configuration> <args> <arg>-copy-constructor</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -252,6 +280,10 @@ <configuration> <args> <arg>-copy-constructor</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -275,6 +307,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>protected</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -297,6 +333,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>protected</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -319,6 +359,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>protected</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -341,6 +385,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>protected</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -364,6 +412,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>public</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -386,6 +438,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>public</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -408,6 +464,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>public</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -430,6 +490,10 @@ <arg>-copy-constructor</arg> <arg>-cc-visibility</arg> <arg>public</arg> + <arg>-XtoString</arg> + <arg>-Xequals</arg> + <arg>-XhashCode</arg> + <arg>-Xcopyable</arg> </args> <schemaDirectory>src/main/schemas</schemaDirectory> <bindingDirectory>src/main/jaxb</bindingDirectory> @@ -466,6 +530,11 @@ <scope>compile</scope> </dependency> <dependency> + <groupId>org.jvnet.jaxb2_commons</groupId> + <artifactId>basic</artifactId> + <scope>compile</scope> + </dependency> + <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.1</version> Added: trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java =================================================================== --- trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java (rev 0) +++ trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java 2009-08-17 08:10:04 UTC (rev 62) @@ -0,0 +1,58 @@ +/* + * 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: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * o 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. + * + * $Id$ + */ +package net.sourceforge.ccxjc.it; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import net.sourceforge.ccxjc.it.model.priv.collections.valueclass.ccxjcit.ChoiceComplexType; + +/** + * Tests the {@code ChoiceComplexType} complex type. + * + * @author <a href="mailto:cs...@sc...">Christian Schulte</a> + * @version $Id$ + */ +public class ChoiceComplexTypeTest +{ + + public void testChoiceComplexType() throws Exception + { + final JAXBElement<ChoiceComplexType> e = (JAXBElement<ChoiceComplexType>) JAXBContext.newInstance( + ChoiceComplexType.class ).createUnmarshaller().unmarshal( this.getClass().getResource( + "ChoiceComplexTypeTest.xml" ) ); + + final ChoiceComplexType copy = new ChoiceComplexType( e.getValue() ); + for ( Object o : copy.getStringItemOrIntItemOrBase64BinaryItem() ) + { + System.out.println( o ); + } + } + +} Property changes on: trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Modified: trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java =================================================================== --- trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java 2009-08-16 12:25:37 UTC (rev 61) +++ trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java 2009-08-17 08:10:04 UTC (rev 62) @@ -300,6 +300,17 @@ start = System.currentTimeMillis(); for ( int i = runs; i >= 0; i-- ) { + this.assertTestSimpleTypeAttributes( (SimpleTypeAttributes) a.copyTo( null ) ); + } + final long jaxbMillis = System.currentTimeMillis() - start; + + System.gc(); + System.gc(); + System.gc(); + + start = System.currentTimeMillis(); + for ( int i = runs; i >= 0; i-- ) + { this.assertTestSimpleTypeAttributes( new SimpleTypeAttributes( a ) ); } final long copyMillis = System.currentTimeMillis() - start; @@ -311,6 +322,9 @@ System.out.println( "Creating " + runs + " copies using serialization took " + serializableMillis + "ms. (100%)" ); + System.out.println( "Creating " + runs + " copies using jaxb2_commons took " + jaxbMillis + "ms. (" + + ( 100L * jaxbMillis / serializableMillis ) + "%)" ); + System.out.println( "Creating " + runs + " copies using copy constructor took " + copyMillis + "ms. (" + ( 100L * copyMillis / serializableMillis ) + "%)" ); Modified: trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java =================================================================== --- trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java 2009-08-16 12:25:37 UTC (rev 61) +++ trunk/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java 2009-08-17 08:10:04 UTC (rev 62) @@ -32,7 +32,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.Arrays; -import java.util.List; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; @@ -311,9 +310,29 @@ System.gc(); System.gc(); + /* + + java.lang.ClassCastException: [Ljava.lang.Object; + at net.sourceforge.ccxjc.it.model.priv.indexed.valueclass.ccxjcit.SimpleTypeAttributes.copyTo(SimpleTypeAttributes.java:2463) + at net.sourceforge.ccxjc.it.model.priv.indexed.valueclass.ccxjcit.SimpleTypeAttributes.copyTo(SimpleTypeAttributes.java:2483) + at net.sourceforge.ccxjc.it.SimpleTypeAttributesIndexedTest.testSerializable(SimpleTypeAttributesIndexedTest.java:316) + start = System.currentTimeMillis(); for ( int i = runs; i >= 0; i-- ) { + this.assertTestSimpleTypeAttributes( (SimpleTypeAttributes) a.copyTo( null ) ); + } + final long jaxbMillis = System.currentTimeMillis() - start; + + System.gc(); + System.gc(); + System.gc(); + + */ + + start = System.currentTimeMillis(); + for ( int i = runs; i >= 0; i-- ) + { this.assertTestSimpleTypeAttributes( new SimpleTypeAttributes( a ) ); } final long copyMillis = System.currentTimeMillis() - start; @@ -325,6 +344,9 @@ System.out.println( "Creating " + runs + " copies using serialization took " + serializableMillis + "ms. (100%)" ); +// System.out.println( "Creating " + runs + " copies using jaxb2_commons took " + jaxbMillis + "ms. (" + +// ( 100L * jaxbMillis / serializableMillis ) + "%)" ); + System.out.println( "Creating " + runs + " copies using copy constructor took " + copyMillis + "ms. (" + ( 100L * copyMillis / serializableMillis ) + "%)" ); Added: trunk/cc-xjc-it/src/main/resources/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.xml =================================================================== --- trunk/cc-xjc-it/src/main/resources/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.xml (rev 0) +++ trunk/cc-xjc-it/src/main/resources/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.xml 2009-08-17 08:10:04 UTC (rev 62) @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<choice-complex-type-test xmlns="http://sourceforge.net/ccxjc/it" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <base64BinaryItem>FF</base64BinaryItem> + <xhtml:head/> + <choice-complex-type-test> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <stringItem>string</stringItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <intItem>1</intItem> + <xhtml:head/> + <base64BinaryItem>FF</base64BinaryItem> + <xhtml:head/> + </choice-complex-type-test> +</choice-complex-type-test> Property changes on: trunk/cc-xjc-it/src/main/resources/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id Revision Date Added: svn:eol-style + native Modified: trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd =================================================================== (Binary files differ) Modified: trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-16 12:25:37 UTC (rev 61) +++ trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-17 08:10:04 UTC (rev 62) @@ -32,7 +32,6 @@ import com.sun.codemodel.JBlock; import com.sun.codemodel.JCatchBlock; import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; import com.sun.codemodel.JConditional; import com.sun.codemodel.JDefinedClass; import com.sun.codemodel.JExpr; @@ -75,17 +74,7 @@ import java.util.ResourceBundle; import java.util.logging.Level; import javax.xml.bind.JAXBElement; -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerFactoryConfigurationError; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; -import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.ErrorHandler; @@ -102,10 +91,6 @@ private static final String MESSAGE_PREFIX = "CC-XJC"; - private static final String NO_CLASSES_FIELDNAME = "CCXJC_NO_CLASSES"; - - private static final String NO_OBJECTS_FIELDNAME = "CCXJC_NO_OBJECTS"; - private static final String OPTION_NAME = "copy-constructor"; private static final String VISIBILITY_OPTION_NAME = "-cc-visibility"; @@ -127,7 +112,8 @@ "java.math.BigDecimal", "java.math.BigInteger", "java.util.UUID", - "javax.xml.namespace.QName" + "javax.xml.namespace.QName", + "javax.xml.datatype.Duration" }; private static final String[] VISIBILITY_ARGUMENTS = @@ -152,7 +138,7 @@ private String visibility = "package"; - private int target = TARGET_1_5; + private int targetJdk = TARGET_1_5; private BigInteger methodCount; @@ -265,15 +251,15 @@ if ( targetArg.equals( "1.5" ) ) { - this.target = TARGET_1_5; + this.targetJdk = TARGET_1_5; } else if ( targetArg.equals( "1.6" ) ) { - this.target = TARGET_1_6; + this.targetJdk = TARGET_1_6; } else if ( targetArg.equals( "1.7" ) ) { - this.target = TARGET_1_7; + this.targetJdk = TARGET_1_7; } return 2; @@ -356,7 +342,7 @@ private boolean isTargetSupported( final int target ) { - return target <= this.target; + return target <= this.targetJdk; } private JMethod getStandardConstructor( final ClassOutline clazz ) @@ -447,68 +433,6 @@ return null; } - private JFieldVar getNoClassesField( final ClassOutline clazz ) - { - JFieldVar noClassesField; - final int mod = this.getVisibilityModifier(); - - if ( mod != JMod.PRIVATE ) - { - noClassesField = clazz._package().objectFactory().fields().get( NO_CLASSES_FIELDNAME ); - if ( noClassesField == null ) - { - noClassesField = clazz._package().objectFactory().field( - JMod.PRIVATE | JMod.STATIC | JMod.FINAL, Class[].class, NO_CLASSES_FIELDNAME, - JExpr.newArray( clazz.parent().getCodeModel().ref( Class.class ), 0 ) ); - - } - } - else - { - noClassesField = clazz.implClass.fields().get( NO_CLASSES_FIELDNAME ); - if ( noClassesField == null ) - { - noClassesField = clazz.implClass.field( - JMod.PRIVATE | JMod.STATIC | JMod.FINAL, Class[].class, NO_CLASSES_FIELDNAME, - JExpr.newArray( clazz.parent().getCodeModel().ref( Class.class ), 0 ) ); - - } - } - - return noClassesField; - } - - private JFieldVar getNoObjectsField( final ClassOutline clazz ) - { - JFieldVar noObjectsField; - final int mod = this.getVisibilityModifier(); - - if ( mod != JMod.PRIVATE ) - { - noObjectsField = clazz._package().objectFactory().fields().get( NO_OBJECTS_FIELDNAME ); - if ( noObjectsField == null ) - { - noObjectsField = clazz._package().objectFactory().field( - JMod.PRIVATE | JMod.STATIC | JMod.FINAL, Object[].class, NO_OBJECTS_FIELDNAME, - JExpr.newArray( clazz.parent().getCodeModel().ref( Object.class ), 0 ) ); - - } - } - else - { - noObjectsField = clazz.implClass.fields().get( NO_OBJECTS_FIELDNAME ); - if ( noObjectsField == null ) - { - noObjectsField = clazz.implClass.field( - JMod.PRIVATE | JMod.STATIC | JMod.FINAL, Object[].class, NO_OBJECTS_FIELDNAME, - JExpr.newArray( clazz.parent().getCodeModel().ref( Object.class ), 0 ) ); - - } - } - - return noObjectsField; - } - private JInvocation getIsImmutableObjectInvocation( final ClassOutline clazz ) { final int mod = this.getVisibilityModifier(); @@ -624,213 +548,6 @@ return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } - private JInvocation getCopyOfDomElementInvocation( final ClassOutline clazz ) - { - final JCodeModel codeModel = clazz.parent().getCodeModel(); - final JClass elementClass = codeModel.ref( Element.class ); - final JClass transformerFactory = codeModel.ref( TransformerFactory.class ); - final JClass transformerFactoryConfError = codeModel.ref( TransformerFactoryConfigurationError.class ); - final JClass transformerConfException = codeModel.ref( TransformerConfigurationException.class ); - final JClass transformerException = codeModel.ref( TransformerException.class ); - final JClass domSource = codeModel.ref( DOMSource.class ); - final JClass domResult = codeModel.ref( DOMResult.class ); - final JClass document = codeModel.ref( Document.class ); - final JClass assertionError = clazz.parent().getCodeModel().ref( AssertionError.class ); - final JType[] signature = - { - elementClass - }; - - final String methodName = "copyOfDOMElement"; - final int mod = this.getVisibilityModifier(); - - if ( mod != JMod.PRIVATE ) - { - for ( JMethod m : clazz._package().objectFactory().methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return clazz._package().objectFactory().staticInvoke( m ); - } - } - } - else - { - for ( JMethod m : clazz.implClass.methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return JExpr.invoke( m ); - } - } - } - - final JMethod m = - ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, elementClass, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, elementClass, methodName ) ); - - final JVar element = m.param( JMod.FINAL, elementClass, "element" ); - - m.javadoc().append( "Creates and returns a copy of a given DOM {@code Element} instance." ); - m.javadoc().addParam( element ).append( "The instance to copy or {@code null}." ); - m.javadoc().addReturn().append( - "A copy of {@code element} or {@code null} if {@code element} is {@code null}." ); - - m.body().directStatement( "// " + this.getMessage( "title", null ) ); - - final JConditional ifNotNull = m.body()._if( element.ne( JExpr._null() ) ); - final JTryBlock tryTransform = ifNotNull._then()._try(); - - final JVar domSrc = tryTransform.body().decl( JMod.FINAL, domSource, "domSource", - JExpr._new( domSource ).arg( element ) ); - - final JVar domRes = tryTransform.body().decl( JMod.FINAL, domResult, "domResult", - JExpr._new( domResult ) ); - - tryTransform.body().add( JExpr.invoke( JExpr.invoke( - transformerFactory.staticInvoke( "newInstance" ), "newTransformer" ), "transform" ). - arg( domSrc ).arg( domRes ) ); - - tryTransform.body()._return( JExpr.invoke( JExpr.cast( document, JExpr.invoke( - domRes, "getNode" ) ), "getDocumentElement" ) ); - - final JCatchBlock catchTransformerFactoryConfError = tryTransform._catch( transformerFactoryConfError ); - catchTransformerFactoryConfError.body()._throw( JExpr._new( assertionError ).arg( - catchTransformerFactoryConfError.param( "e" ) ) ); - - final JCatchBlock catchTransformerConfException = tryTransform._catch( transformerConfException ); - catchTransformerConfException.body()._throw( JExpr._new( assertionError ).arg( - catchTransformerConfException.param( "e" ) ) ); - - final JCatchBlock catchTransformerException = tryTransform._catch( transformerException ); - catchTransformerException.body()._throw( JExpr._new( assertionError ).arg( - catchTransformerException.param( "e" ) ) ); - - m.body()._return( JExpr._null() ); - this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); - } - - private JInvocation getCopyOfDurationInvocation( final ClassOutline clazz ) - { - final JClass durationClass = clazz.parent().getCodeModel().ref( Duration.class ); - final JClass datatypeFactory = clazz.parent().getCodeModel().ref( DatatypeFactory.class ); - final JClass assertionError = clazz.parent().getCodeModel().ref( AssertionError.class ); - final JClass datatypeConfigurationException = - clazz.parent().getCodeModel().ref( DatatypeConfigurationException.class ); - - final JType[] signature = - { - durationClass - }; - - final String methodName = "copyOfDuration"; - final int mod = this.getVisibilityModifier(); - - if ( mod != JMod.PRIVATE ) - { - for ( JMethod m : clazz._package().objectFactory().methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return clazz._package().objectFactory().staticInvoke( m ); - } - } - } - else - { - for ( JMethod m : clazz.implClass.methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return JExpr.invoke( m ); - } - } - } - - final JMethod m = - ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, Duration.class, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, Duration.class, methodName ) ); - - final JVar duration = m.param( JMod.FINAL, durationClass, "duration" ); - - m.javadoc().append( "Creates and returns a copy of a given {@code Duration} instance." ); - m.javadoc().addParam( duration ).append( "The instance to copy to {@code null}." ); - m.javadoc().addReturn().append( - "A copy of {@code duration} or {@code null} if {@code duration} is {@code null}." ); - - m.body().directStatement( "// " + this.getMessage( "title", null ) ); - - final JConditional ifNotNull = m.body()._if( duration.ne( JExpr._null() ) ); - final JTryBlock tryCopyDuration = ifNotNull._then()._try(); - - tryCopyDuration.body()._return( JExpr.invoke( datatypeFactory.staticInvoke( "newInstance" ), "newDuration" ). - arg( JExpr.invoke( duration, "toString" ) ) ); - - final JCatchBlock catchDatatypeConfiguration = tryCopyDuration._catch( datatypeConfigurationException ); - catchDatatypeConfiguration.body()._throw( JExpr._new( assertionError ).arg( - catchDatatypeConfiguration.param( "e" ) ) ); - - m.body()._return( JExpr._null() ); - this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); - } - - private JInvocation getCopyOfXMLGregorianCalendarInvocation( final ClassOutline clazz ) - { - final JClass xmlGregorianCalendar = clazz.parent().getCodeModel().ref( XMLGregorianCalendar.class ); - final JType[] signature = - { - xmlGregorianCalendar - }; - - final String methodName = "copyOfXMLGregorianCalendar"; - final int mod = this.getVisibilityModifier(); - - if ( mod != JMod.PRIVATE ) - { - for ( JMethod m : clazz._package().objectFactory().methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return clazz._package().objectFactory().staticInvoke( m ); - } - } - } - else - { - for ( JMethod m : clazz.implClass.methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return JExpr.invoke( m ); - } - } - } - - final JMethod m = - ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, XMLGregorianCalendar.class, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, XMLGregorianCalendar.class, methodName ) ); - - final JVar cal = m.param( JMod.FINAL, xmlGregorianCalendar, "calendar" ); - - m.javadoc().append( "Creates and returns a copy of a given {@code XMLGregorianCalendar} instance." ); - m.javadoc().addParam( cal ).append( "The instance to copy or {@code null}." ); - m.javadoc().addReturn().append( - "A copy of {@code calendar} or {@code null} if {@code calendar} is {@code null}." ); - - m.body().directStatement( "// " + this.getMessage( "title", null ) ); - - final JConditional ifNotNull = m.body()._if( cal.ne( JExpr._null() ) ); - ifNotNull._then()._return( JExpr.cast( xmlGregorianCalendar, cal.invoke( "clone" ) ) ); - m.body()._return( JExpr._null() ); - this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); - } - private JInvocation getCopyOfArrayInvocation( final ClassOutline clazz ) { final JClass object = clazz.parent().getCodeModel().ref( Object.class ); @@ -888,7 +605,8 @@ forEachRef.test( i.gte( JExpr.lit( 0 ) ) ); forEachRef.update( i.decr() ); forEachRef.body().add( array.staticInvoke( "set" ).arg( copy ).arg( i ). - arg( array.staticInvoke( "get" ).arg( arrayArg ).arg( i ) ) ); + arg( this.getCopyOfObjectInvocation( clazz ).arg( array.staticInvoke( "get" ). + arg( arrayArg ).arg( i ) ) ) ); arrayNotNull._then()._return( copy ); m.body()._return( JExpr._null() ); @@ -908,6 +626,8 @@ final JClass illegalArgument = clazz.parent().getCodeModel().ref( IllegalArgumentException.class ); final JClass initializerError = clazz.parent().getCodeModel().ref( ExceptionInInitializerError.class ); final JClass assertionError = clazz.parent().getCodeModel().ref( AssertionError.class ); + final JClass classArray = clazz.parent().getCodeModel().ref( Class[].class ); + final JClass objectArray = clazz.parent().getCodeModel().ref( Object[].class ); final String methodName = "copyOfObject"; final int mod = this.getVisibilityModifier(); @@ -964,8 +684,8 @@ isImmutable._then()._return( o ); final JConditional instanceOfDOMElement = objectNotNull._then()._if( o._instanceof( element ) ); - instanceOfDOMElement._then()._return( this.getCopyOfDomElementInvocation( clazz ). - arg( JExpr.cast( element, o ) ) ); + instanceOfDOMElement._then()._return( JExpr.cast( element, JExpr.invoke( + JExpr.cast( element, o ), "cloneNode" ).arg( JExpr.TRUE ) ) ); final JConditional instanceOfElement = objectNotNull._then()._if( o._instanceof( jaxbElement ) ); instanceOfElement._then()._return( this.getCopyOfJaxbElementInvocation( clazz ). @@ -973,8 +693,8 @@ final JTryBlock tryCloneMethod = objectNotNull._then()._try(); tryCloneMethod.body()._return( JExpr.invoke( JExpr.invoke( JExpr.invoke( o, "getClass" ), "getMethod" ). - arg( "clone" ).arg( this.getNoClassesField( clazz ) ), "invoke" ).arg( o ). - arg( this.getNoObjectsField( clazz ) ) ); + arg( "clone" ).arg( JExpr.cast( classArray, JExpr._null() ) ), "invoke" ).arg( o ). + arg( JExpr.cast( objectArray, JExpr._null() ) ) ); final JExpression assertionErrorMsg = JExpr.lit( "Unexpected instance during copying object '" ).plus( o ).plus( JExpr.lit( "'." ) ); @@ -1026,57 +746,6 @@ return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } - private JInvocation getCopyOfClassInfoInvocation( final ClassOutline clazz, final CTypeInfo type ) - { - final JType javaType = type.toType( clazz.parent(), Aspect.IMPLEMENTATION ); - final JType[] signature = - { - javaType - }; - - final String methodName = "copyOf" + this.getMethodNamePart( javaType ); - final int mod = this.getVisibilityModifier(); - - if ( mod != JMod.PRIVATE ) - { - for ( JMethod m : clazz._package().objectFactory().methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return clazz._package().objectFactory().staticInvoke( m ); - } - } - } - else - { - for ( JMethod m : clazz.implClass.methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return JExpr.invoke( m ); - } - } - } - - final JMethod m = - ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, javaType, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, javaType, methodName ) ); - - final JVar param = m.param( JMod.FINAL, javaType, "clazz" ); - - m.javadoc().append( "Creates and returns a copy of a given {@code " + javaType.binaryName() + "} instance." ); - m.javadoc().addParam( param ).append( "The instance to copy or {@code null}." ); - m.javadoc().addReturn().append( "A copy of {@code clazz} or {@code null} if {@code clazz} is {@code null}." ); - - m.body().directStatement( "// " + this.getMessage( "title", null ) ); - - m.body()._if( param.ne( JExpr._null() ) )._then()._return( JExpr.invoke( param, "clone" ) ); - m.body()._return( JExpr._null() ); - this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); - } - private JInvocation getCopyOfClassInfoElementInvocation( final ClassOutline clazz, final CNonElement type ) { final JType jaxbElement = clazz.parent().getCodeModel().ref( JAXBElement.class ); @@ -1535,8 +1204,69 @@ } else { - final JType byteArray = classOutline.parent().getCodeModel().ref( byte[].class ); - expr = JExpr.cast( byteArray, this.getCopyOfArrayInvocation( classOutline ).arg( source ) ); + final JClass byteArray = classOutline.parent().getCodeModel().ref( byte[].class ); + final JClass array = classOutline.parent().getCodeModel().ref( Array.class ); + final JClass system = classOutline.parent().getCodeModel().ref( System.class ); + + final JType[] signature = + { + byteArray + }; + + final String methodName = "copyOfBytes"; + final int mod = this.getVisibilityModifier(); + + if ( mod != JMod.PRIVATE ) + { + for ( JMethod m : classOutline._package().objectFactory().methods() ) + { + if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) + { + return classOutline._package().objectFactory().staticInvoke( m ).arg( source ); + } + } + } + else + { + for ( JMethod m : classOutline.implClass.methods() ) + { + if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) + { + return JExpr.invoke( m ).arg( source ); + } + } + } + + final JMethod m = + ( mod != JMod.PRIVATE + ? classOutline._package().objectFactory().method( JMod.STATIC | mod, byteArray, methodName ) + : classOutline.implClass.method( JMod.STATIC | mod, byteArray, methodName ) ); + + final JVar bytes = m.param( JMod.FINAL, byteArray, "bytes" ); + + m.javadoc().append( "Creates and returns a copy of a given array of bytes." ); + m.javadoc().addParam( bytes ).append( "The array to copy or {@code null}." ); + m.javadoc().addReturn().append( + "A copy of {@code bytes} or {@code null} if {@code bytes} is {@code null}." ); + + m.body().directStatement( "// " + this.getMessage( "title", null ) ); + + final JConditional bytesNotNull = m.body()._if( bytes.ne( JExpr._null() ) ); + final JVar copy = bytesNotNull._then().decl( + JMod.FINAL, byteArray, "copy", JExpr.cast( byteArray, array.staticInvoke( "newInstance" ).arg( + bytes.invoke( "getClass" ).invoke( "getComponentType" ) ).arg( bytes.ref( "length" ) ) ) ); + + bytesNotNull._then().add( system.staticInvoke( "arraycopy" ).arg( bytes ).arg( JExpr.lit( 0 ) ). + arg( copy ).arg( JExpr.lit( 0 ) ).arg( bytes.ref( "length" ) ) ); + + bytesNotNull._then()._return( copy ); + + m.body()._return( JExpr._null() ); + this.methodCount = this.methodCount.add( BigInteger.ONE ); + expr = ( mod != JMod.PRIVATE + ? classOutline._package().objectFactory().staticInvoke( m ).arg( source ) + : JExpr.invoke( m ).arg( source ) ); + } } else if ( type == CBuiltinLeafInfo.BIG_DECIMAL || type == CBuiltinLeafInfo.BIG_INTEGER || @@ -1552,11 +1282,14 @@ } else if ( type == CBuiltinLeafInfo.CALENDAR ) { - expr = this.getCopyOfXMLGregorianCalendarInvocation( classOutline ).arg( source ); + final JClass xmlCal = classOutline.parent().getCodeModel().ref( XMLGregorianCalendar.class ); + expr = JOp.cond( source.eq( JExpr._null() ), JExpr._null(), + JExpr.cast( xmlCal, source.invoke( "clone" ) ) ); + } else if ( type == CBuiltinLeafInfo.DURATION ) { - expr = this.getCopyOfDurationInvocation( classOutline ).arg( source ); + expr = source; } else if ( type == CBuiltinLeafInfo.DATA_HANDLER || type == CBuiltinLeafInfo.IMAGE || type == CBuiltinLeafInfo.XML_SOURCE ) @@ -1573,7 +1306,10 @@ block.directStatement( "// CWildcardTypeInfo: " + type.toType( classOutline.parent(), Aspect.IMPLEMENTATION ).binaryName() ); - return this.getCopyOfDomElementInvocation( classOutline ).arg( source ); + return JOp.cond( source.eq( JExpr._null() ), JExpr._null(), + JExpr.cast( classOutline.parent().getCodeModel().ref( Element.class ), + source.invoke( "cloneNode" ).arg( JExpr.TRUE ) ) ); + } private JExpression getClassInfoCopyExpression( final ClassOutline classOutline, final CClassInfo type, @@ -1582,7 +1318,7 @@ block.directStatement( "// CClassInfo: " + type.toType( classOutline.parent(), Aspect.IMPLEMENTATION ).binaryName() ); - return this.getCopyOfClassInfoInvocation( classOutline, type ).arg( source ); + return JOp.cond( source.eq( JExpr._null() ), JExpr._null(), source.invoke( "clone" ) ); } private JExpression getNonElementCopyExpression( final ClassOutline classOutline, final CNonElement type, Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-16 12:25:37 UTC (rev 61) +++ trunk/pom.xml 2009-08-17 08:10:04 UTC (rev 62) @@ -254,6 +254,11 @@ <artifactId>cc-xjc-plugin</artifactId> <version>${pom.version}</version> </dependency> + <dependency> + <groupId>org.jvnet.jaxb2_commons</groupId> + <artifactId>basic</artifactId> + <version>0.4.1.5</version> + </dependency> </dependencies> </plugin> <plugin> @@ -400,6 +405,11 @@ <version>${jaxbImplVersion}</version> </dependency> <dependency> + <groupId>org.jvnet.jaxb2_commons</groupId> + <artifactId>basic</artifactId> + <version>0.4.1.5</version> + </dependency> + <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> Modified: trunk/src/main/changes/changes.xml =================================================================== --- trunk/src/main/changes/changes.xml 2009-08-16 12:25:37 UTC (rev 61) +++ trunk/src/main/changes/changes.xml 2009-08-17 08:10:04 UTC (rev 62) @@ -105,6 +105,10 @@ <code>QName</code> to the list of immutable types.]]> </action> <action dev="schulte2005" type="update"><![CDATA[ + Removed generated <code>copyOfDuration</code> methods and added + <code>Duration</code> to the list of immutable types.]]> + </action> + <action dev="schulte2005" type="update"><![CDATA[ Added support for <code>@XmlAnyAttribute</code>.]]> </action> <action dev="schulte2005" type="update"><![CDATA[ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-17 08:31:49
|
Revision: 63 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=63&view=rev Author: schulte2005 Date: 2009-08-17 08:31:35 +0000 (Mon, 17 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare release cc-xjc-1.0-beta-8 Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-17 08:10:04 UTC (rev 62) +++ trunk/cc-xjc-dist/pom.xml 2009-08-17 08:31:35 UTC (rev 63) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-8-SNAPSHOT</version> + <version>1.0-beta-8</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-17 08:10:04 UTC (rev 62) +++ trunk/cc-xjc-it/pom.xml 2009-08-17 08:31:35 UTC (rev 63) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-8-SNAPSHOT</version> + <version>1.0-beta-8</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-17 08:10:04 UTC (rev 62) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-17 08:31:35 UTC (rev 63) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-8-SNAPSHOT</version> + <version>1.0-beta-8</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-17 08:10:04 UTC (rev 62) +++ trunk/pom.xml 2009-08-17 08:31:35 UTC (rev 63) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-8-SNAPSHOT</version> + <version>1.0-beta-8</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-8</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-8</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-8</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-17 08:32:42
|
Revision: 65 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=65&view=rev Author: schulte2005 Date: 2009-08-17 08:32:35 +0000 (Mon, 17 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-17 08:32:09 UTC (rev 64) +++ trunk/cc-xjc-dist/pom.xml 2009-08-17 08:32:35 UTC (rev 65) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-8</version> + <version>1.0-beta-9-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-17 08:32:09 UTC (rev 64) +++ trunk/cc-xjc-it/pom.xml 2009-08-17 08:32:35 UTC (rev 65) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-8</version> + <version>1.0-beta-9-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-17 08:32:09 UTC (rev 64) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-17 08:32:35 UTC (rev 65) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-8</version> + <version>1.0-beta-9-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-17 08:32:09 UTC (rev 64) +++ trunk/pom.xml 2009-08-17 08:32:35 UTC (rev 65) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-8</version> + <version>1.0-beta-9-SNAPSHOT</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-8</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-8</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-8</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-18 15:01:41
|
Revision: 66 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=66&view=rev Author: schulte2005 Date: 2009-08-18 15:01:28 +0000 (Tue, 18 Aug 2009) Log Message: ----------- o Corrected a ClassCastException thrown when copying CWildcardTypeInfo properties. o Corrected handling of non-collection properties referencing multiple types. o Updated to stop logging when verbose option is not set. o Changed default visibility from package to private. Modified Paths: -------------- trunk/cc-xjc-it/pom.xml trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties trunk/src/main/changes/changes.xml trunk/src/site/apt/examples.apt trunk/src/site/apt/index.apt Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-17 08:32:35 UTC (rev 65) +++ trunk/cc-xjc-it/pom.xml 2009-08-18 15:01:28 UTC (rev 66) @@ -208,6 +208,8 @@ <configuration> <args> <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>package</arg> <arg>-XtoString</arg> <arg>-Xequals</arg> <arg>-XhashCode</arg> @@ -232,6 +234,8 @@ <configuration> <args> <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>package</arg> <arg>-XtoString</arg> <arg>-Xequals</arg> <arg>-XhashCode</arg> @@ -256,6 +260,8 @@ <configuration> <args> <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>package</arg> <arg>-XtoString</arg> <arg>-Xequals</arg> <arg>-XhashCode</arg> @@ -280,6 +286,8 @@ <configuration> <args> <arg>-copy-constructor</arg> + <arg>-cc-visibility</arg> + <arg>package</arg> <arg>-XtoString</arg> <arg>-Xequals</arg> <arg>-XhashCode</arg> Modified: trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd =================================================================== (Binary files differ) Modified: trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-17 08:32:35 UTC (rev 65) +++ trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-18 15:01:28 UTC (rev 66) @@ -60,7 +60,16 @@ import com.sun.tools.xjc.outline.ClassOutline; import com.sun.tools.xjc.outline.FieldOutline; import com.sun.tools.xjc.outline.Outline; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.InvalidClassException; +import java.io.NotSerializableException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OptionalDataException; +import java.io.Serializable; +import java.io.StreamCorruptedException; import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.math.BigInteger; @@ -155,7 +164,13 @@ @Override public String getUsage() { - return this.getMessage( "usage", null ); + return new StringBuffer().append( " -" ).append( OPTION_NAME ).append( " : " ). + append( this.getMessage( "usage", null ) ).append( System.getProperty( "line.separator" ) ). + append( " " ).append( VISIBILITY_OPTION_NAME ).append( " : " ). + append( this.getMessage( "visibilityUsage", null ) ).append( System.getProperty( "line.separator" ) ). + append( " " ).append( TARGET_OPTION_NAME ).append( " : " ). + append( this.getMessage( "targetUsage", null ) ).toString(); + } @Override @@ -433,16 +448,22 @@ return null; } - private JInvocation getIsImmutableObjectInvocation( final ClassOutline clazz ) + private JInvocation getCopyOfJaxbElementInvocation( final ClassOutline clazz ) { + final JClass jaxbElement = clazz.parent().getCodeModel().ref( JAXBElement.class ); + final JType[] signature = + { + jaxbElement + }; + + final String methodName = "copyOFJAXBElement"; final int mod = this.getVisibilityModifier(); - final String methodName = "isImmutableObject"; if ( mod != JMod.PRIVATE ) { for ( JMethod m : clazz._package().objectFactory().methods() ) { - if ( m.name().equals( methodName ) ) + if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) { return clazz._package().objectFactory().staticInvoke( m ); } @@ -452,7 +473,7 @@ { for ( JMethod m : clazz.implClass.methods() ) { - if ( m.name().equals( methodName ) ) + if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) { return JExpr.invoke( m ); } @@ -461,53 +482,63 @@ final JMethod m = ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, boolean.class, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, boolean.class, methodName ) ); + ? clazz._package().objectFactory().method( JMod.STATIC | mod, JAXBElement.class, methodName ) + : clazz.implClass.method( JMod.STATIC | mod, JAXBElement.class, methodName ) ); - final JVar o = m.param( JMod.FINAL, Object.class, "o" ); + final JVar element = m.param( JMod.FINAL, jaxbElement, "element" ); - m.javadoc().append( "Tests a given object against a list of known immutable types." ); - m.javadoc().addParam( o ).append( "The object to test." ); - m.javadoc().addReturn().append( "{@code true} if {@code o} is a known immutable type; {@code false} else." ); + m.javadoc().append( "Creates and returns a copy of a given {@code JAXBElement} instance." ); + m.javadoc().addParam( element ).append( "The instance to copy or {@code null}." ); + m.javadoc().addReturn().append( + "A copy of {@code element} or {@code null} if {@code element} is {@code null}." ); m.body().directStatement( "// " + this.getMessage( "title", null ) ); - for ( String immutableName : IMMUTABLE_NAMES ) - { - m.body()._if( o._instanceof( clazz.parent().getCodeModel().ref( immutableName ) ) ). - _then()._return( JExpr.TRUE ); + final JConditional isNotNull = m.body()._if( element.ne( JExpr._null() ) ); + final JExpression newElement = JExpr._new( jaxbElement ). + arg( JExpr.invoke( element, "getName" ) ). + arg( JExpr.invoke( element, "getDeclaredType" ) ). + arg( JExpr.invoke( element, "getScope" ) ). + arg( JExpr.invoke( element, "getValue" ) ); - } + final JVar copy = isNotNull._then().decl( JMod.FINAL, jaxbElement, "copy", newElement ); + isNotNull._then().add( copy.invoke( "setNil" ).arg( element.invoke( "isNil" ) ) ); + isNotNull._then().add( copy.invoke( "setValue" ).arg( this.getCopyOfObjectInvocation( clazz ). + arg( JExpr.invoke( copy, "getValue" ) ) ) ); - m.body()._return( JExpr.FALSE ); + isNotNull._then()._return( copy ); + m.body()._return( JExpr._null() ); this.methodCount = this.methodCount.add( BigInteger.ONE ); return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } - private JInvocation getCopyOfJaxbElementInvocation( final ClassOutline clazz ) + private JInvocation getCopyOfBytesInvocation( final ClassOutline classOutline ) { - final JClass jaxbElement = clazz.parent().getCodeModel().ref( JAXBElement.class ); + final JClass byteArray = classOutline.parent().getCodeModel().ref( byte[].class ); + final JClass array = classOutline.parent().getCodeModel().ref( Array.class ); + final JClass system = classOutline.parent().getCodeModel().ref( System.class ); + final JType[] signature = { - jaxbElement + byteArray }; - final String methodName = "copyOFJAXBElement"; + final String methodName = "copyOfBytes"; final int mod = this.getVisibilityModifier(); if ( mod != JMod.PRIVATE ) { - for ( JMethod m : clazz._package().objectFactory().methods() ) + for ( JMethod m : classOutline._package().objectFactory().methods() ) { if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) { - return clazz._package().objectFactory().staticInvoke( m ); + return classOutline._package().objectFactory().staticInvoke( m ); } } } else { - for ( JMethod m : clazz.implClass.methods() ) + for ( JMethod m : classOutline.implClass.methods() ) { if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) { @@ -518,40 +549,50 @@ final JMethod m = ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, JAXBElement.class, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, JAXBElement.class, methodName ) ); + ? classOutline._package().objectFactory().method( JMod.STATIC | mod, byteArray, methodName ) + : classOutline.implClass.method( JMod.STATIC | mod, byteArray, methodName ) ); - final JVar element = m.param( JMod.FINAL, jaxbElement, "element" ); + final JVar bytes = m.param( JMod.FINAL, byteArray, "bytes" ); - m.javadoc().append( "Creates and returns a copy of a given {@code JAXBElement} instance." ); - m.javadoc().addParam( element ).append( "The instance to copy or {@code null}." ); + m.javadoc().append( "Creates and returns a copy of a given array of bytes." ); + m.javadoc().addParam( bytes ).append( "The array to copy or {@code null}." ); m.javadoc().addReturn().append( - "A copy of {@code element} or {@code null} if {@code element} is {@code null}." ); + "A copy of {@code bytes} or {@code null} if {@code bytes} is {@code null}." ); m.body().directStatement( "// " + this.getMessage( "title", null ) ); - final JConditional isNotNull = m.body()._if( element.ne( JExpr._null() ) ); - final JExpression newElement = JExpr._new( jaxbElement ). - arg( JExpr.invoke( element, "getName" ) ). - arg( JExpr.invoke( element, "getDeclaredType" ) ). - arg( JExpr.invoke( element, "getScope" ) ). - arg( JExpr.invoke( element, "getValue" ) ); + if ( this.isTargetSupported( TARGET_1_6 ) ) + { + final JClass arrays = classOutline.parent().getCodeModel().ref( Arrays.class ); + m.body()._return( JOp.cond( bytes.eq( JExpr._null() ), JExpr._null(), arrays.staticInvoke( "copyOf" ). + arg( bytes ).arg( bytes.ref( "length" ) ) ) ); - final JVar copy = isNotNull._then().decl( JMod.FINAL, jaxbElement, "copy", newElement ); - isNotNull._then().add( copy.invoke( "setNil" ).arg( element.invoke( "isNil" ) ) ); - isNotNull._then().add( copy.invoke( "setValue" ).arg( this.getCopyOfObjectInvocation( clazz ). - arg( JExpr.invoke( copy, "getValue" ) ) ) ); + } + else + { + final JConditional bytesNotNull = m.body()._if( bytes.ne( JExpr._null() ) ); + final JVar copy = bytesNotNull._then().decl( + JMod.FINAL, byteArray, "copy", JExpr.cast( byteArray, array.staticInvoke( "newInstance" ).arg( + bytes.invoke( "getClass" ).invoke( "getComponentType" ) ).arg( bytes.ref( "length" ) ) ) ); - isNotNull._then()._return( copy ); - m.body()._return( JExpr._null() ); + bytesNotNull._then().add( system.staticInvoke( "arraycopy" ).arg( bytes ).arg( JExpr.lit( 0 ) ). + arg( copy ).arg( JExpr.lit( 0 ) ).arg( bytes.ref( "length" ) ) ); + + bytesNotNull._then()._return( copy ); + + m.body()._return( JExpr._null() ); + } + this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); + return ( mod != JMod.PRIVATE ? classOutline._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } private JInvocation getCopyOfArrayInvocation( final ClassOutline clazz ) { final JClass object = clazz.parent().getCodeModel().ref( Object.class ); final JClass array = clazz.parent().getCodeModel().ref( Array.class ); + final JClass byteArray = clazz.parent().getCodeModel().ref( byte[].class ); + final JType[] signature = { object @@ -594,13 +635,19 @@ m.body().directStatement( "// " + this.getMessage( "title", null ) ); final JConditional arrayNotNull = m.body()._if( arrayArg.ne( JExpr._null() ) ); - final JVar len = arrayNotNull._then().decl( JMod.FINAL, clazz.parent().getCodeModel().INT, "len", - array.staticInvoke( "getLength" ).arg( arrayArg ) ); + final JConditional isArrayOfBytes = + arrayNotNull._then()._if( arrayArg.invoke( "getClass" ).eq( byteArray.dotclass() ) ); - final JVar copy = arrayNotNull._then().decl( JMod.FINAL, object, "copy", array.staticInvoke( "newInstance" ). + isArrayOfBytes._then()._return( + this.getCopyOfBytesInvocation( clazz ).arg( JExpr.cast( byteArray, arrayArg ) ) ); + + final JVar len = isArrayOfBytes._else().decl( + JMod.FINAL, clazz.parent().getCodeModel().INT, "len", array.staticInvoke( "getLength" ).arg( arrayArg ) ); + + final JVar copy = isArrayOfBytes._else().decl( JMod.FINAL, object, "copy", array.staticInvoke( "newInstance" ). arg( arrayArg.invoke( "getClass" ).invoke( "getComponentType" ) ).arg( len ) ); - final JForLoop forEachRef = arrayNotNull._then()._for(); + final JForLoop forEachRef = isArrayOfBytes._else()._for(); final JVar i = forEachRef.init( clazz.parent().getCodeModel().INT, "i", len.minus( JExpr.lit( 1 ) ) ); forEachRef.test( i.gte( JExpr.lit( 0 ) ) ); forEachRef.update( i.decr() ); @@ -608,12 +655,127 @@ arg( this.getCopyOfObjectInvocation( clazz ).arg( array.staticInvoke( "get" ). arg( arrayArg ).arg( i ) ) ) ); - arrayNotNull._then()._return( copy ); + isArrayOfBytes._else()._return( copy ); m.body()._return( JExpr._null() ); this.methodCount = this.methodCount.add( BigInteger.ONE ); return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } + private JInvocation getCopyOfSerializableInvocation( final ClassOutline clazz ) + { + final JClass serializable = clazz.parent().getCodeModel().ref( Serializable.class ); + final JClass byteArrayOutputStream = clazz.parent().getCodeModel().ref( ByteArrayOutputStream.class ); + final JClass byteArrayInputStream = clazz.parent().getCodeModel().ref( ByteArrayInputStream.class ); + final JClass objectOutputStream = clazz.parent().getCodeModel().ref( ObjectOutputStream.class ); + final JClass objectInputStream = clazz.parent().getCodeModel().ref( ObjectInputStream.class ); + final JClass ioException = clazz.parent().getCodeModel().ref( IOException.class ); + final JClass invalidClass = clazz.parent().getCodeModel().ref( InvalidClassException.class ); + final JClass notSerializable = clazz.parent().getCodeModel().ref( NotSerializableException.class ); + final JClass streamCorrupted = clazz.parent().getCodeModel().ref( StreamCorruptedException.class ); + final JClass securityException = clazz.parent().getCodeModel().ref( SecurityException.class ); + final JClass optionalData = clazz.parent().getCodeModel().ref( OptionalDataException.class ); + final JClass classNotFound = clazz.parent().getCodeModel().ref( ClassNotFoundException.class ); + final JClass assertionError = clazz.parent().getCodeModel().ref( AssertionError.class ); + final JType[] signature = + { + serializable + }; + + final String methodName = "copyOfSerializable"; + final int mod = this.getVisibilityModifier(); + + if ( mod != JMod.PRIVATE ) + { + for ( JMethod m : clazz._package().objectFactory().methods() ) + { + if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) + { + return clazz._package().objectFactory().staticInvoke( m ); + } + } + } + else + { + for ( JMethod m : clazz.implClass.methods() ) + { + if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) + { + return JExpr.invoke( m ); + } + } + } + + final JMethod m = + ( mod != JMod.PRIVATE + ? clazz._package().objectFactory().method( JMod.STATIC | mod, serializable, methodName ) + : clazz.implClass.method( JMod.STATIC | mod, serializable, methodName ) ); + + final JVar s = m.param( JMod.FINAL, serializable, "serializable" ); + + m.javadoc().append( "Creates and returns a copy of a given {@code Serializable}." ); + m.javadoc().addParam( s ).append( "The instance to copy or {@code null}." ); + m.javadoc().addReturn().append( + "A copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}." ); + + m.body().directStatement( "// " + this.getMessage( "title", null ) ); + + final JConditional sNotNull = m.body()._if( s.ne( JExpr._null() ) ); + final JTryBlock tryClone = sNotNull._then()._try(); + + final JVar byteArrayOutput = tryClone.body().decl( + JMod.FINAL, byteArrayOutputStream, "byteArrayOutput", JExpr._new( byteArrayOutputStream ) ); + + final JVar objectOutput = tryClone.body().decl( + JMod.FINAL, objectOutputStream, "out", JExpr._new( objectOutputStream ).arg( byteArrayOutput ) ); + + tryClone.body().add( objectOutput.invoke( "writeObject" ).arg( s ) ); + tryClone.body().add( objectOutput.invoke( "close" ) ); + + final JVar byteArrayInput = tryClone.body().decl( + JMod.FINAL, byteArrayInputStream, "byteArrayInput", + JExpr._new( byteArrayInputStream ).arg( byteArrayOutput.invoke( "toByteArray" ) ) ); + + final JVar objectInput = tryClone.body().decl( + JMod.FINAL, objectInputStream, "in", JExpr._new( objectInputStream ).arg( byteArrayInput ) ); + + tryClone.body()._return( JExpr.cast( serializable, objectInput.invoke( "readObject" ) ) ); + + final JExpression assertionErrorMsg = + JExpr.lit( "Unexpected instance during copying object '" ).plus( s ).plus( JExpr.lit( "'." ) ); + + final JCatchBlock catchSecurityException = tryClone._catch( securityException ); + catchSecurityException.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchSecurityException.param( "e" ) ) ) ); + + final JCatchBlock catchClassNotFound = tryClone._catch( classNotFound ); + catchClassNotFound.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchClassNotFound.param( "e" ) ) ) ); + + final JCatchBlock catchInvalidClass = tryClone._catch( invalidClass ); + catchInvalidClass.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchInvalidClass.param( "e" ) ) ) ); + + final JCatchBlock catchNotSerializable = tryClone._catch( notSerializable ); + catchNotSerializable.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchNotSerializable.param( "e" ) ) ) ); + + final JCatchBlock catchStreamCorrupted = tryClone._catch( streamCorrupted ); + catchStreamCorrupted.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchStreamCorrupted.param( "e" ) ) ) ); + + final JCatchBlock catchOptionalData = tryClone._catch( optionalData ); + catchOptionalData.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchOptionalData.param( "e" ) ) ) ); + + final JCatchBlock catchIOException = tryClone._catch( ioException ); + catchIOException.body()._throw( JExpr.cast( assertionError, JExpr._new( assertionError ). + arg( assertionErrorMsg ).invoke( "initCause" ).arg( catchIOException.param( "e" ) ) ) ); + + m.body()._return( JExpr._null() ); + this.methodCount = this.methodCount.add( BigInteger.ONE ); + return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); + } + private JInvocation getCopyOfObjectInvocation( final ClassOutline clazz ) { final JClass object = clazz.parent().getCodeModel().ref( Object.class ); @@ -628,6 +790,7 @@ final JClass assertionError = clazz.parent().getCodeModel().ref( AssertionError.class ); final JClass classArray = clazz.parent().getCodeModel().ref( Class[].class ); final JClass objectArray = clazz.parent().getCodeModel().ref( Object[].class ); + final JClass serializable = clazz.parent().getCodeModel().ref( Serializable.class ); final String methodName = "copyOfObject"; final int mod = this.getVisibilityModifier(); @@ -678,10 +841,12 @@ isArray._then()._return( this.getCopyOfArrayInvocation( clazz ).arg( o ) ); - final JConditional isImmutable = objectNotNull._then()._if( - this.getIsImmutableObjectInvocation( clazz ).arg( o ) ); + for ( String immutableName : IMMUTABLE_NAMES ) + { + objectNotNull._then()._if( o._instanceof( clazz.parent().getCodeModel().ref( immutableName ) ) ). + _then()._return( o ); - isImmutable._then()._return( o ); + } final JConditional instanceOfDOMElement = objectNotNull._then()._if( o._instanceof( element ) ); instanceOfDOMElement._then()._return( JExpr.cast( element, JExpr.invoke( @@ -700,6 +865,10 @@ JExpr.lit( "Unexpected instance during copying object '" ).plus( o ).plus( JExpr.lit( "'." ) ); final JCatchBlock catchNoSuchMethod = tryCloneMethod._catch( noSuchMethod ); + final JConditional instanceOfSerializable = catchNoSuchMethod.body()._if( o._instanceof( serializable ) ); + instanceOfSerializable._then()._return( this.getCopyOfSerializableInvocation( clazz ). + arg( JExpr.cast( serializable, o ) ) ); + catchNoSuchMethod.body().directStatement( "// Please report this at " + this.getMessage( "bugtrackerUrl", null ) ); @@ -746,10 +915,10 @@ return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } - private JInvocation getCopyOfClassInfoElementInvocation( final ClassOutline clazz, final CNonElement type ) + private JInvocation getCopyOfClassInfoElementInvocation( final FieldOutline fieldOutline, final CNonElement type ) { - final JType jaxbElement = clazz.parent().getCodeModel().ref( JAXBElement.class ); - final JType javaType = type.toType( clazz.parent(), Aspect.IMPLEMENTATION ); + final JType jaxbElement = fieldOutline.parent().parent().getCodeModel().ref( JAXBElement.class ); + final JType javaType = type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ); final JType[] signature = { jaxbElement @@ -760,17 +929,17 @@ if ( mod != JMod.PRIVATE ) { - for ( JMethod m : clazz._package().objectFactory().methods() ) + for ( JMethod m : fieldOutline.parent()._package().objectFactory().methods() ) { if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) { - return clazz._package().objectFactory().staticInvoke( m ); + return fieldOutline.parent()._package().objectFactory().staticInvoke( m ); } } } else { - for ( JMethod m : clazz.implClass.methods() ) + for ( JMethod m : fieldOutline.parent().implClass.methods() ) { if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) { @@ -781,8 +950,8 @@ final JMethod m = ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, jaxbElement, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, jaxbElement, methodName ) ); + ? fieldOutline.parent()._package().objectFactory().method( JMod.STATIC | mod, jaxbElement, methodName ) + : fieldOutline.parent().implClass.method( JMod.STATIC | mod, jaxbElement, methodName ) ); final JVar e = m.param( JMod.FINAL, jaxbElement, "e" ); @@ -805,21 +974,25 @@ final JVar copy = elementNotNull._then().decl( jaxbElement, "copy", newElement ); elementNotNull._then().add( copy.invoke( "setNil" ).arg( e.invoke( "isNil" ) ) ); elementNotNull._then().add( copy.invoke( "setValue" ).arg( this.getCopyExpression( - clazz, type, elementNotNull._then(), JExpr.cast( javaType, copy.invoke( "getValue" ) ) ) ) ); + fieldOutline, type, elementNotNull._then(), JExpr.cast( javaType, copy.invoke( "getValue" ) ) ) ) ); elementNotNull._then()._return( copy ); m.body()._return( JExpr._null() ); this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); + return ( mod != JMod.PRIVATE + ? fieldOutline.parent()._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); + } - private JInvocation getCopyOfArrayInfoInvocation( final ClassOutline clazz, final CArrayInfo array ) + private JInvocation getCopyOfArrayInfoInvocation( final FieldOutline fieldOutline, final CArrayInfo array ) { final JType arrayType = - ( array.getAdapterUse() != null ? clazz.parent().getModel().getTypeInfo( array.getAdapterUse().customType ). - toType( clazz.parent(), Aspect.IMPLEMENTATION ) : array.toType( clazz.parent(), Aspect.IMPLEMENTATION ) ); + ( array.getAdapterUse() != null + ? fieldOutline.parent().parent().getModel().getTypeInfo( array.getAdapterUse().customType ). + toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ) + : array.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ) ); - final JType itemType = array.getItemType().toType( clazz.parent(), Aspect.IMPLEMENTATION ); + final JType itemType = array.getItemType().toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ); final JType[] signature = { arrayType @@ -830,17 +1003,17 @@ if ( mod != JMod.PRIVATE ) { - for ( JMethod m : clazz._package().objectFactory().methods() ) + for ( JMethod m : fieldOutline.parent()._package().objectFactory().methods() ) { if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) { - return clazz._package().objectFactory().staticInvoke( m ); + return fieldOutline.parent()._package().objectFactory().staticInvoke( m ); } } } else { - for ( JMethod m : clazz.implClass.methods() ) + for ( JMethod m : fieldOutline.parent().implClass.methods() ) { if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) { @@ -851,8 +1024,8 @@ final JMethod m = ( mod != JMod.PRIVATE - ? clazz._package().objectFactory().method( JMod.STATIC | mod, arrayType, methodName ) - : clazz.implClass.method( JMod.STATIC | mod, arrayType, methodName ) ); + ? fieldOutline.parent()._package().objectFactory().method( JMod.STATIC | mod, arrayType, methodName ) + : fieldOutline.parent().implClass.method( JMod.STATIC | mod, arrayType, methodName ) ); final JVar a = m.param( JMod.FINAL, arrayType, "array" ); @@ -866,21 +1039,203 @@ final JVar copy = arrayNotNull._then().decl( arrayType, "copy", JExpr.newArray( itemType, a.ref( "length" ) ) ); final JForLoop forEachItem = arrayNotNull._then()._for(); final JVar i = forEachItem.init( - clazz.parent().getCodeModel().INT, "i", a.ref( "length" ).minus( JExpr.lit( 1 ) ) ); + fieldOutline.parent().parent().getCodeModel().INT, "i", a.ref( "length" ).minus( JExpr.lit( 1 ) ) ); forEachItem.test( i.gte( JExpr.lit( 0 ) ) ); forEachItem.update( i.decr() ); final JExpression copyExpr = - this.getCopyExpression( clazz, array.getItemType(), forEachItem.body(), a.component( i ) ); + this.getCopyExpression( fieldOutline, array.getItemType(), forEachItem.body(), a.component( i ) ); forEachItem.body().assign( copy.component( i ), copyExpr ); arrayNotNull._then()._return( copy ); m.body()._return( JExpr._null() ); this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); + return ( mod != JMod.PRIVATE + ? fieldOutline.parent()._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); + } + private JMethod getCopyOfPropertyMethod( final FieldOutline field ) + { + final String methodName = "copy" + field.getPropertyInfo().getName( true ); + for ( JMethod m : field.parent().implClass.methods() ) + { + if ( m.name().equals( methodName ) ) + { + return m; + } + } + + final JClass jaxbElement = field.parent().parent().getCodeModel().ref( JAXBElement.class ); + final JClass assertionError = field.parent().parent().getCodeModel().ref( AssertionError.class ); + final JMethod m = field.parent().implClass.method( + this.getVisibilityModifier() | JMod.STATIC, field.getRawType(), methodName ); + + final JVar source = m.param( JMod.FINAL, field.getRawType(), "source" ); + + m.javadoc().append( "Copies property {@code " + field.getPropertyInfo().getName( true ) + "}." ); + m.javadoc().addParam( source ).append( "The source to copy from or {@code null}." ); + m.javadoc().addReturn().append( "A copy of {@code source} or {@code null} if {@code source} is {@code null}." ); + m.body().directStatement( "// " + this.getMessage( "title", null ) ); + + final JConditional sourceNotNull = m.body()._if( source.ne( JExpr._null() ) ); + +// m.body()._if( source.eq( JExpr._null() ) )._then()._throw( JExpr._new( nullPointerException ).arg( "source" ) ); +// m.body()._if( target.eq( JExpr._null() ) )._then()._throw( JExpr._new( nullPointerException ).arg( "target" ) ); + + final List<CClassInfo> referencedClassInfos = + new ArrayList<CClassInfo>( field.getPropertyInfo().ref().size() ); + + final List<CElementInfo> referencedElementInfos = + new ArrayList<CElementInfo>( field.getPropertyInfo().ref().size() ); + + final List<CTypeInfo> referencedTypeInfos = + new ArrayList<CTypeInfo>( field.getPropertyInfo().ref().size() ); + + final List<JType> referencedClassTypes = + new ArrayList<JType>( field.getPropertyInfo().ref().size() ); + + final List<JType> referencedContentTypes = + new ArrayList<JType>( field.getPropertyInfo().ref().size() ); + + final List<JType> referencedTypes = + new ArrayList<JType>( field.getPropertyInfo().ref().size() ); + + for ( CTypeInfo type : field.getPropertyInfo().ref() ) + { + if ( type instanceof CElementInfo ) + { + final CElementInfo e = (CElementInfo) type; + final JType contentType = e.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + + if ( !referencedContentTypes.contains( contentType ) ) + { + referencedContentTypes.add( contentType ); + referencedElementInfos.add( e ); + } + } + else if ( type instanceof CClassInfo ) + { + final CClassInfo c = (CClassInfo) type; + final JClass classType = c.toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + + if ( !referencedClassTypes.contains( classType ) ) + { + referencedClassTypes.add( classType ); + referencedClassInfos.add( c ); + } + } + else + { + final JType javaType = type.toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + if ( !referencedTypes.contains( javaType ) ) + { + referencedTypes.add( javaType ); + referencedTypeInfos.add( type ); + } + } + } + + Collections.sort( referencedClassInfos, new CClassInfoComparator( field.parent().parent() ) ); + Collections.sort( referencedElementInfos, new CElementInfoComparator( field.parent().parent() ) ); + Collections.sort( referencedTypeInfos, new CTypeInfoComparator( field.parent().parent() ) ); + Collections.reverse( referencedClassInfos ); + Collections.reverse( referencedElementInfos ); + Collections.reverse( referencedTypeInfos ); + + if ( !referencedElementInfos.isEmpty() ) + { + final JBlock elementBlock = sourceNotNull._then()._if( source._instanceof( jaxbElement ) )._then(); + + for ( CElementInfo elementInfo : referencedElementInfos ) + { + final JType contentType = + ( elementInfo.getAdapterUse() != null ? field.parent().parent().getModel().getTypeInfo( + elementInfo.getAdapterUse().customType ).toType( field.parent().parent(), Aspect.IMPLEMENTATION ) + : elementInfo.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ) ); + + final JConditional ifInstanceOf = elementBlock._if( JExpr.invoke( JExpr.cast( + jaxbElement, source ), "getValue" )._instanceof( contentType ) ); + + final JExpression copyExpr = this.getCopyExpression( field, elementInfo, ifInstanceOf._then(), + JExpr.cast( jaxbElement, source ) ); + + if ( copyExpr == null ) + { + this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName() + } ), null ); + + } + else + { + ifInstanceOf._then()._return( copyExpr ); + } + } + } + + for ( CClassInfo classInfo : referencedClassInfos ) + { + final JType javaType = + ( classInfo.getAdapterUse() != null ? field.parent().parent().getModel().getTypeInfo( + classInfo.getAdapterUse().customType ).toType( field.parent().parent(), Aspect.IMPLEMENTATION ) + : classInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ) ); + + final JConditional ifInstanceOf = sourceNotNull._then()._if( source._instanceof( javaType ) ); + + final JExpression copyExpr = + this.getCopyExpression( field, classInfo, ifInstanceOf._then(), JExpr.cast( javaType, source ) ); + + if ( copyExpr == null ) + { + this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName() + } ), null ); + + } + else + { + ifInstanceOf._then()._return( copyExpr ); + } + } + + for ( CTypeInfo typeInfo : referencedTypeInfos ) + { + final JType javaType = typeInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + final JConditional ifInstanceOf = sourceNotNull._then()._if( source._instanceof( javaType ) ); + final JExpression copyExpr = + this.getCopyExpression( field, typeInfo, ifInstanceOf._then(), JExpr.cast( javaType, source ) ); + + if ( copyExpr == null ) + { + this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName() + } ), null ); + + } + else + { + ifInstanceOf._then()._return( copyExpr ); + } + } + + sourceNotNull._then().directStatement( "// Please report this at " + this.getMessage( "bugtrackerUrl", null ) ); + sourceNotNull._then()._throw( JExpr._new( assertionError ).arg( JExpr.lit( "Unexpected instance '" ). + plus( source ).plus( JExpr.lit( "' for property '" + field.getPropertyInfo().getName( true ) + + "' of class '" + field.parent().implClass.binaryName() + "'." ) ) ) ); + + m.body()._return( JExpr._null() ); + this.methodCount = this.methodCount.add( BigInteger.ONE ); + return m; + } + private JMethod getCopyOfCollectionMethod( final FieldOutline field ) { final String methodName = "copy" + field.getPropertyInfo().getName( true ); @@ -980,6 +1335,9 @@ Collections.sort( referencedClassInfos, new CClassInfoComparator( field.parent().parent() ) ); Collections.sort( referencedElementInfos, new CElementInfoComparator( field.parent().parent() ) ); Collections.sort( referencedTypeInfos, new CTypeInfoComparator( field.parent().parent() ) ); + Collections.reverse( referencedClassInfos ); + Collections.reverse( referencedElementInfos ); + Collections.reverse( referencedTypeInfos ); final JForLoop copyLoop; final JVar it; @@ -1016,42 +1374,6 @@ copy = null; } - for ( CClassInfo classInfo : referencedClassInfos ) - { - final JType javaType = - ( classInfo.getAdapterUse() != null ? field.parent().parent().getModel().getTypeInfo( classInfo. - getAdapterUse().customType ).toType( field.parent().parent(), Aspect.IMPLEMENTATION ) - : classInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ) ); - - final JConditional ifInstanceOf = copyLoop.body()._if( next._instanceof( javaType ) ); - - final JExpression copyExpr = this.getCopyExpression( - field.parent(), classInfo, ifInstanceOf._then(), JExpr.cast( javaType, next ) ); - - if ( copyExpr == null ) - { - this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] - { - field.getPropertyInfo().getName( true ), - field.parent().implClass.binaryName() - } ), null ); - - } - else - { - if ( field.getRawType().isArray() ) - { - ifInstanceOf._then().assign( copy.component( it ), copyExpr ); - } - else - { - ifInstanceOf._then().invoke( target, "add" ).arg( copyExpr ); - } - } - - ifInstanceOf._then()._continue(); - } - if ( !referencedElementInfos.isEmpty() ) { final JBlock copyBlock = copyLoop.body()._if( next._instanceof( jaxbElement ) )._then(); @@ -1066,8 +1388,8 @@ final JConditional ifInstanceOf = copyBlock._if( JExpr.invoke( JExpr.cast( jaxbElement, next ), "getValue" )._instanceof( contentType ) ); - final JExpression copyExpr = this.getCopyExpression( - field.parent(), elementInfo, ifInstanceOf._then(), JExpr.cast( jaxbElement, next ) ); + final JExpression copyExpr = + this.getCopyExpression( field, elementInfo, ifInstanceOf._then(), JExpr.cast( jaxbElement, next ) ); if ( copyExpr == null ) { @@ -1094,12 +1416,48 @@ } } + for ( CClassInfo classInfo : referencedClassInfos ) + { + final JType javaType = + ( classInfo.getAdapterUse() != null ? field.parent().parent().getModel().getTypeInfo( classInfo. + getAdapterUse().customType ).toType( field.parent().parent(), Aspect.IMPLEMENTATION ) + : classInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ) ); + + final JConditional ifInstanceOf = copyLoop.body()._if( next._instanceof( javaType ) ); + + final JExpression copyExpr = + this.getCopyExpression( field, classInfo, ifInstanceOf._then(), JExpr.cast( javaType, next ) ); + + if ( copyExpr == null ) + { + this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName() + } ), null ); + + } + else + { + if ( field.getRawType().isArray() ) + { + ifInstanceOf._then().assign( copy.component( it ), copyExpr ); + } + else + { + ifInstanceOf._then().invoke( target, "add" ).arg( copyExpr ); + } + } + + ifInstanceOf._then()._continue(); + } + for ( CTypeInfo typeInfo : referencedTypeInfos ) { final JType javaType = typeInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ); final JConditional ifInstanceOf = copyLoop.body()._if( next._instanceof( javaType ) ); - final JExpression copyExpr = this.getCopyExpression( - field.parent(), typeInfo, ifInstanceOf._then(), JExpr.cast( javaType, next ) ); + final JExpression copyExpr = + this.getCopyExpression( field, typeInfo, ifInstanceOf._then(), JExpr.cast( javaType, next ) ); if ( copyExpr == null ) { @@ -1139,38 +1497,38 @@ return m; } - private JExpression getCopyExpression( final ClassOutline classOutline, final CTypeInfo type, + private JExpression getCopyExpression( final FieldOutline fieldOutline, final CTypeInfo type, final JBlock block, final JExpression source ) { JExpression expr = null; if ( type instanceof CBuiltinLeafInfo ) { - expr = this.getBuiltinCopyExpression( classOutline, (CBuiltinLeafInfo) type, block, source ); + expr = this.getBuiltinCopyExpression( fieldOutline, (CBuiltinLeafInfo) type, block, source ); } else if ( type instanceof CWildcardTypeInfo ) { - expr = this.getWildcardCopyExpression( classOutline, (CWildcardTypeInfo) type, block, source ); + expr = this.getWildcardCopyExpression( fieldOutline, (CWildcardTypeInfo) type, block, source ); } else if ( type instanceof CClassInfo ) { - expr = this.getClassInfoCopyExpression( classOutline, (CClassInfo) type, block, source ); + expr = this.getClassInfoCopyExpression( fieldOutline, (CClassInfo) type, block, source ); } else if ( type instanceof CEnumLeafInfo ) { - expr = this.getEnumLeafInfoCopyExpression( classOutline, (CEnumLeafInfo) type, block, source ); + expr = this.getEnumLeafInfoCopyExpression( fieldOutline, (CEnumLeafInfo) type, block, source ); } else if ( type instanceof CArrayInfo ) { - expr = this.getArrayCopyExpression( classOutline, (CArrayInfo) type, block, source ); + expr = this.getArrayCopyExpression( fieldOutline, (CArrayInfo) type, block, source ); } else if ( type instanceof CElementInfo ) { - expr = this.getElementCopyExpression( classOutline, (CElementInfo) type, block, source ); + expr = this.getElementCopyExpression( fieldOutline, (CElementInfo) type, block, source ); } else if ( type instanceof CNonElement ) { - expr = this.getNonElementCopyExpression( classOutline, (CNonElement) type, block, source ); + expr = this.getNonElementCopyExpression( fieldOutline, (CNonElement) type, block, source ); } if ( expr != null ) @@ -1181,93 +1539,21 @@ return expr; } - private JExpression getBuiltinCopyExpression( final ClassOutline classOutline, final CBuiltinLeafInfo type, + private JExpression getBuiltinCopyExpression( final FieldOutline fieldOutline, final CBuiltinLeafInfo type, final JBlock block, final JExpression source ) { JExpression expr = null; - block.directStatement( - "// CBuiltinLeafInfo: " + type.toType( classOutline.parent(), Aspect.IMPLEMENTATION ).binaryName() ); + block.directStatement( "// CBuiltinLeafInfo: " + + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); if ( type == CBuiltinLeafInfo.ANYTYPE ) { - expr = this.getCopyOfObjectInvocation( classOutline ).arg( source ); + expr = this.getCopyOfObjectInvocation( fieldOutline.parent() ).arg( source ); } else if ( type == CBuiltinLeafInfo.BASE64_BYTE_ARRAY ) { - if ( this.isTargetSupported( TARGET_1_6 ) ) - { - final JClass arrays = classOutline.parent().getCodeModel().ref( Arrays.class ); - expr = JOp.cond( source.eq( JExpr._null() ), JExpr._null(), arrays.staticInvoke( "copyOf" ). - arg( source ).arg( source.ref( "length" ) ) ); - - } - else - { - final JClass byteArray = classOutline.parent().getCodeModel().ref( byte[].class ); - final JClass array = classOutline.parent().getCodeModel().ref( Array.class ); - final JClass system = classOutline.parent().getCodeModel().ref( System.class ); - - final JType[] signature = - { - byteArray - }; - - final String methodName = "copyOfBytes"; - final int mod = this.getVisibilityModifier(); - - if ( mod != JMod.PRIVATE ) - { - for ( JMethod m : classOutline._package().objectFactory().methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return classOutline._package().objectFactory().staticInvoke( m ).arg( source ); - } - } - } - else - { - for ( JMethod m : classOutline.implClass.methods() ) - { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) - { - return JExpr.invoke( m ).arg( source ); - } - } - } - - final JMethod m = - ( mod != JMod.PRIVATE - ? classOutline._package().objectFactory().method( JMod.STATIC | mod, byteArray, methodName ) - : classOutline.implClass.method( JMod.STATIC | mod, byteArray, methodName ) ); - - final JVar bytes = m.param( JMod.FINAL, byteArray, "bytes" ); - - m.javadoc().append( "Creates and returns a copy of a given array of bytes." ); - m.javadoc().addParam( bytes ).append( "The array to copy or {@code null}." ); - m.javadoc().addReturn().append( - "A copy of {@code bytes} or {@code null} if {@code bytes} is {@code null}." ); - - m.body().directStatement( "// " + this.getMessage( "title", null ) ); - - final JConditional bytesNotNull = m.body()._if( bytes.ne( JExpr._null() ) ); - final JVar copy = bytesNotNull._then().decl( - JMod.FINAL, byteArray, "copy", JExpr.cast( byteArray, array.staticInvoke( "newInstance" ).arg( - bytes.invoke( "getClass" ).invoke( "getComponentType" ) ).arg( bytes.ref( "length" ) ) ) ); - - bytesNotNull._then().add( system.staticInvoke( "arraycopy" ).arg( bytes ).arg( JExpr.lit( 0 ) ). - arg( copy ).arg( JExpr.lit( 0 ) ).arg( bytes.ref( "length" ) ) ); - - bytesNotNull._then()._return( copy ); - - m.body()._return( JExpr._null() ); - this.methodCount = this.methodCount.add( BigInteger.ONE ); - expr = ( mod != JMod.PRIVATE - ? classOutline._package().objectFactory().staticInvoke( m ).arg( source ) - : JExpr.invoke( m ).arg( source ) ); - - } + expr = this.getCopyOfBytesInvocation( fieldOutline.parent() ).arg( source ); } else if ( type == CBuiltinLeafInfo.BIG_DECIMAL || type == CBuiltinLeafInfo.BIG_INTEGER || type == CBuiltinLeafInfo.STRING || type == CBuiltinLeafInfo.BOOLEAN || type == CBuiltinLeafInfo.INT || @@ -1282,7 +1568,7 @@ } else if ( type == CBuiltinLeafInfo.CALENDAR ) { - final JClass xmlCal = classOutline.parent().getCodeModel().ref( XMLGregorianCalendar.class ); + final JClass xmlCal = fieldOutline.parent().parent().getCodeModel().ref( XMLGregorianCalendar.class ); expr = JOp.cond( source.eq( JExpr._null() ), JExpr._null(), JExpr.cast( xmlCal, source.invoke( "clone" ) ) ); @@ -1294,63 +1580,69 @@ else if ( type == CBuiltinLeafInfo.DATA_HANDLER || type == CBuiltinLeafInfo.IMAGE || type == CBuiltinLeafInfo.XML_SOURCE ) { + this.log( Level.WARNING, "cannotCopyType", new Object[] + { + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).fullName(), + fieldOutline.getPropertyInfo().getName( true ), fieldOutline.parent().implClass.fullName() + } ); + expr = source; } return expr; } - private JExpression getWildcardCopyExpression( final ClassOutline classOutline, final CWildcardTypeInfo type, + private JExpression getWildcardCopyExpression( final FieldOutline fieldOutline, final CWildcardTypeInfo type, final JBlock block, final JExpression source ) { block.directStatement( "// CWildcardTypeInfo: " + - type.toType( classOutline.parent(), Aspect.IMPLEMENTATION ).binaryName() ); + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); return JOp.cond( source.eq( JExpr._null() ), JExpr._null(), - JExpr.cast( classOutline.parent().getCodeModel().ref( Element.class ), + JExpr.cast( fieldOutline.parent().parent().getCodeModel().ref( Element.class ), source.invoke( "cloneNode" ).arg( JExpr.TRUE ) ) ); } - private JExpression getClassInfoCopyExpression( final ClassOutline classOutline, final CClassInfo type, + private JExpression getClassInfoCopyExpression( final FieldOutline fieldOutline, final CClassInfo type, final JBlock block, final JExpression source ) { block.directStatement( - "// CClassInfo: " + type.toType( classOutline.parent(), Aspect.IMPLEMENTATION ).binaryName() ); + "// CClassInfo: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); return JOp.cond( source.eq( JExpr._null() ), JExpr._null(), source.invoke( "clone" ) ); } - private JExpression getNonElementCopyExpression( final ClassOutline classOutline, final CNonElement type, + private JExpression getNonElementCopyExpression( final FieldOutline fieldOutline, final CNonElement type, final JBlock block, final JExpression source ) { block.directStatement( - "// CNonElement: " + type.toType( classOutline.parent(), Aspect.IMPLEMENTATION ).binaryName() ); + "// CNonElement: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); return null; } - private JExpression getArrayCopyExpression( final ClassOutline classOutline, final CArrayInfo type, + private JExpression getArrayCopyExpression( final FieldOutline fieldOutline, final CArrayInfo type, final JBlock block, final JExpression source ) { block.directStatement( "// CArrayInfo: " + type.fullName() ); - return this.getCopyOfArrayInfoInvocation( classOutline, type ).arg( source ); + return this.getCopyOfArrayInfoInvocation( fieldOutline, type ).arg( source ); } - private JExpression getElementCopyExpression( final ClassOutline classOutline, final CElementInfo type, + private JExpression getElementCopyExpression( final FieldOutline fieldOutline, final CElementInfo type, final JBlock block, final JExpression source ) { block.directStatement( - "// CElementInfo: " + type.toType( classOutline.parent(), Aspect.IMPLEMENTATION ).binaryName() ); + "// CElementInfo: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); - return this.getCopyOfClassInfoElementInvocation( classOutline, type.getContentType() ).arg( source ); + return this.getCopyOfClassInfoElementInvocation( fieldOutline, type.getContentType() ).arg( source ); } - private JExpression getEnumLeafInfoCopyExpression( final ClassOutline classOutline, final CEnumLeafInfo type, + private JExpression getEnumLeafInfoCopyExpression( final FieldOutline fieldOutline, final CEnumLeafInfo type, final JBlock block, final JExpression source ) { block.directStatement( - "// CEnumLeafInfo: " + type.toType( classOutline.parent(), Aspect.IMPLEMENTATION ).binaryName() ); + "// CEnumLeafInfo: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); return source; } @@ -1422,6 +1714,11 @@ } else { + this.log( Level.WARNING, "fieldWithoutProperties", new Object[] + { + field.name(), clazz.implClass.name() + } ); + paramNotNullBlock.assign( JExpr.refthis( field.name() ), JExpr.cast( field.type(), this.getCopyOfObjectInvocation( clazz ).arg( o.ref( field ) ) ) ); @@ -1488,14 +1785,25 @@ } else { - final CTypeInfo typeInfo = - ( field.getPropertyInfo().getAdapter() != null ? field.parent().parent().getModel().getTypeInfo( - field.getPropertyInfo().getAdapter().customType ) : field.getPropertyInfo().ref().iterator().next() ); + final JExpression copyExpr; + if ( field.getPropertyInfo().ref().size() != 1 ) + { + block.directStatement( "// '" + field.getPropertyInfo().getName( true ) + "' property." ); + copyExpr = JExpr.invoke( this.getCopyOfPropertyMethod( field ) ).arg( o.invoke( getter ) ); + } + else + { + final CTypeInfo typeInfo = + ( field.getPropertyInfo().getAdapter() != null ? field.parent().parent().getModel().getTypeInfo( + field.getPropertyInfo().getAdapter().customType ) : field.getPropertyInfo().ref().iterator(). + next() ); - final JType javaType = typeInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ); - final JExpression copyExpr = this.getCopyExpression( field.parent(), typeInfo, block, JExpr.cast( - javaType, JExpr.invoke( o, getter ) ) ); + final JType javaType = typeInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + copyExpr = this.getCopyExpression( field, typeInfo, block, + JExpr.cast( javaType, JExpr.invoke( o, getter ) ) ); + } + if ( copyExpr == null ) { this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] @@ -1546,21 +1854,30 @@ final StringBuffer b = new StringBuffer().append( "[" ).append( MESSAGE_PREFIX ).append( "] [" ). append( level.getLocalizedName() ).append( "] " ).append( this.getMessage( key, args ) ); + int logLevel = Level.WARNING.intValue(); if ( this.options != null && !this.op... [truncated message content] |
From: <sch...@us...> - 2009-08-18 15:27:42
|
Revision: 67 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=67&view=rev Author: schulte2005 Date: 2009-08-18 15:27:31 +0000 (Tue, 18 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare release cc-xjc-1.0-beta-9 Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-18 15:01:28 UTC (rev 66) +++ trunk/cc-xjc-dist/pom.xml 2009-08-18 15:27:31 UTC (rev 67) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-9-SNAPSHOT</version> + <version>1.0-beta-9</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-18 15:01:28 UTC (rev 66) +++ trunk/cc-xjc-it/pom.xml 2009-08-18 15:27:31 UTC (rev 67) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-9-SNAPSHOT</version> + <version>1.0-beta-9</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-18 15:01:28 UTC (rev 66) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-18 15:27:31 UTC (rev 67) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-9-SNAPSHOT</version> + <version>1.0-beta-9</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-18 15:01:28 UTC (rev 66) +++ trunk/pom.xml 2009-08-18 15:27:31 UTC (rev 67) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-9-SNAPSHOT</version> + <version>1.0-beta-9</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-9</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-9</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-9</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-18 15:30:16
|
Revision: 69 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=69&view=rev Author: schulte2005 Date: 2009-08-18 15:30:07 +0000 (Tue, 18 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-18 15:29:26 UTC (rev 68) +++ trunk/cc-xjc-dist/pom.xml 2009-08-18 15:30:07 UTC (rev 69) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-9</version> + <version>1.0-beta-10-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-18 15:29:26 UTC (rev 68) +++ trunk/cc-xjc-it/pom.xml 2009-08-18 15:30:07 UTC (rev 69) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-9</version> + <version>1.0-beta-10-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-18 15:29:26 UTC (rev 68) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-18 15:30:07 UTC (rev 69) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-9</version> + <version>1.0-beta-10-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-18 15:29:26 UTC (rev 68) +++ trunk/pom.xml 2009-08-18 15:30:07 UTC (rev 69) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-9</version> + <version>1.0-beta-10-SNAPSHOT</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-9</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-9</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-9</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-21 06:40:49
|
Revision: 70 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=70&view=rev Author: schulte2005 Date: 2009-08-21 06:40:39 +0000 (Fri, 21 Aug 2009) Log Message: ----------- o Updated generated javadoc. Modified Paths: -------------- trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/src/main/changes/changes.xml trunk/src/site/apt/examples.apt Modified: trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-18 15:30:07 UTC (rev 69) +++ trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-21 06:40:39 UTC (rev 70) @@ -1652,7 +1652,7 @@ final JMethod ctor = clazz.implClass.constructor( JMod.PUBLIC ); ctor.body().directStatement( " // " + this.getMessage( "title", null ) ); ctor.body().invoke( "super" ); - ctor.javadoc().add( "Creates a new {@code " + clazz.implClass.fullName() + "} instance." ); + ctor.javadoc().add( "Creates a new {@code " + clazz.implClass.name() + "} instance." ); this.constructorCount = this.constructorCount.add( BigInteger.ONE ); return ctor; } @@ -1662,8 +1662,8 @@ final JMethod ctor = clazz.implClass.constructor( JMod.PUBLIC ); final JVar o = ctor.param( JMod.FINAL, clazz.implClass, "o" ); - ctor.javadoc().add( "Creates a new {@code " + clazz.implClass.fullName() + - "} instance by copying a given instance." ); + ctor.javadoc().add( "Creates a new {@code " + clazz.implClass.name() + + "} instance by deeply copying a given instance." ); ctor.javadoc().addParam( o ).add( "The instance to copy or {@code null}." ); @@ -1754,8 +1754,8 @@ cloneMethod.annotate( Override.class ); clazz.implClass._implements( clazz.parent().getCodeModel().ref( Cloneable.class ) ); - cloneMethod.javadoc().append( "Creates and returns a copy of this object.\n" ); - cloneMethod.javadoc().addReturn().append( "A clone of this instance." ); + cloneMethod.javadoc().append( "Creates and returns a deep copy of this object.\n" ); + cloneMethod.javadoc().addReturn().append( "A deep copy of this instance." ); this.methodCount = this.methodCount.add( BigInteger.ONE ); return cloneMethod; } Modified: trunk/src/main/changes/changes.xml =================================================================== --- trunk/src/main/changes/changes.xml 2009-08-18 15:30:07 UTC (rev 69) +++ trunk/src/main/changes/changes.xml 2009-08-21 06:40:39 UTC (rev 70) @@ -134,5 +134,12 @@ </action> </release> + <!-- ******************************************************************* --> + <release version="1.0-beta-10" date="2009-08-21"> + <action dev="schulte2005" type="fix"><![CDATA[ + Updated generated javadoc.]]> + </action> + </release> + </body> </document> Modified: trunk/src/site/apt/examples.apt =================================================================== --- trunk/src/site/apt/examples.apt 2009-08-18 15:30:07 UTC (rev 69) +++ trunk/src/site/apt/examples.apt 2009-08-21 06:40:39 UTC (rev 70) @@ -68,7 +68,7 @@ <dependency> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc-plugin</artifactId> - <version>1.0-beta-9</version> + <version>1.0-beta-10</version> </dependency> </dependencies> <executions> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-21 07:03:56
|
Revision: 71 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=71&view=rev Author: schulte2005 Date: 2009-08-21 07:03:43 +0000 (Fri, 21 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare release cc-xjc-1.0-beta-10 Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-21 06:40:39 UTC (rev 70) +++ trunk/cc-xjc-dist/pom.xml 2009-08-21 07:03:43 UTC (rev 71) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-10-SNAPSHOT</version> + <version>1.0-beta-10</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-21 06:40:39 UTC (rev 70) +++ trunk/cc-xjc-it/pom.xml 2009-08-21 07:03:43 UTC (rev 71) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-10-SNAPSHOT</version> + <version>1.0-beta-10</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-21 06:40:39 UTC (rev 70) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-21 07:03:43 UTC (rev 71) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-10-SNAPSHOT</version> + <version>1.0-beta-10</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-21 06:40:39 UTC (rev 70) +++ trunk/pom.xml 2009-08-21 07:03:43 UTC (rev 71) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-10-SNAPSHOT</version> + <version>1.0-beta-10</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-10</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-10</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-10</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-21 07:05:13
|
Revision: 73 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=73&view=rev Author: schulte2005 Date: 2009-08-21 07:05:07 +0000 (Fri, 21 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-21 07:04:22 UTC (rev 72) +++ trunk/cc-xjc-dist/pom.xml 2009-08-21 07:05:07 UTC (rev 73) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-10</version> + <version>1.0-beta-11-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-21 07:04:22 UTC (rev 72) +++ trunk/cc-xjc-it/pom.xml 2009-08-21 07:05:07 UTC (rev 73) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-10</version> + <version>1.0-beta-11-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-21 07:04:22 UTC (rev 72) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-21 07:05:07 UTC (rev 73) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-10</version> + <version>1.0-beta-11-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-21 07:04:22 UTC (rev 72) +++ trunk/pom.xml 2009-08-21 07:05:07 UTC (rev 73) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-10</version> + <version>1.0-beta-11-SNAPSHOT</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-10</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-10</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-10</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-23 00:19:15
|
Revision: 74 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=74&view=rev Author: schulte2005 Date: 2009-08-23 00:19:00 +0000 (Sun, 23 Aug 2009) Log Message: ----------- o Updated generated copyOfObject methods to support copying of XMLGregorianCalendar instances without using reflection. o Updated generated copyOfArray methods to support copying of primitive arrays without using reflection. Modified Paths: -------------- trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties trunk/src/main/changes/changes.xml trunk/src/site/apt/download.apt trunk/src/site/apt/examples.apt trunk/src/site/apt/index.apt Modified: trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-21 07:05:07 UTC (rev 73) +++ trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-23 00:19:00 UTC (rev 74) @@ -72,6 +72,7 @@ import java.io.StreamCorruptedException; import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; +import java.math.BigDecimal; import java.math.BigInteger; import java.text.MessageFormat; import java.util.ArrayList; @@ -81,9 +82,12 @@ import java.util.Iterator; import java.util.List; import java.util.ResourceBundle; +import java.util.UUID; import java.util.logging.Level; import javax.xml.bind.JAXBElement; +import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; import org.w3c.dom.Element; import org.xml.sax.ErrorHandler; @@ -106,25 +110,42 @@ private static final String TARGET_OPTION_NAME = "-cc-target"; - private static final String[] IMMUTABLE_NAMES = + private static final Class[] IMMUTABLE_TYPES = { - "java.lang.Boolean", - "java.lang.Byte", - "java.lang.Character", - "java.lang.Double", - "java.lang.Enum", - "java.lang.Float", - "java.lang.Integer", - "java.lang.Long", - "java.lang.Short", - "java.lang.String", - "java.math.BigDecimal", - "java.math.BigInteger", - "java.util.UUID", - "javax.xml.namespace.QName", - "javax.xml.datatype.Duration" + Boolean.class, + Byte.class, + Character.class, + Double.class, + Enum.class, + Float.class, + Integer.class, + Long.class, + Short.class, + String.class, + BigDecimal.class, + BigInteger.class, + UUID.class, + QName.class, + Duration.class }; + private static final Class[] CLONEABLE_TYPES = + { + XMLGregorianCalendar.class + }; + + private static final Class[] PRIMITIVE_ARRAY_TYPES = + { + boolean[].class, + byte[].class, + char[].class, + double[].class, + float[].class, + int[].class, + long[].class, + short[].class + }; + private static final String[] VISIBILITY_ARGUMENTS = { "private", "package", "protected", "public" @@ -201,11 +222,17 @@ { if ( i + 1 >= args.length ) { - throw new BadCommandLineException( this.getMessage( "badOption", new Object[] + final String missingOptionArgument = this.getMessage( "missingOptionArgument", new Object[] { - VISIBILITY_OPTION_NAME, supportedVisibilities.append( ']' ).toString() - } ) ); + VISIBILITY_OPTION_NAME + } ); + final String expectedOptionArgument = this.getMessage( "expectedOptionArgument", new Object[] + { + supportedVisibilities.append( ']' ).toString() + } ); + + throw new BadCommandLineException( missingOptionArgument + " " + expectedOptionArgument ); } this.visibility = args[i + 1].trim(); @@ -222,11 +249,12 @@ if ( !supported ) { - throw new BadCommandLineException( this.getMessage( "badOption", new Object[] + final String expectedOptionArgument = this.getMessage( "expectedOptionArgument", new Object[] { - VISIBILITY_OPTION_NAME, supportedVisibilities.append( ']' ).toString() - } ) ); + supportedVisibilities.append( ']' ).toString() + } ); + throw new BadCommandLineException( expectedOptionArgument ); } return 2; @@ -236,11 +264,17 @@ { if ( i + 1 >= args.length ) { - throw new BadCommandLineException( this.getMessage( "badOption", new Object[] + final String missingOptionArgument = this.getMessage( "missingOptionArgument", new Object[] { - TARGET_OPTION_NAME, supportedTargets.append( ']' ).toString() - } ) ); + TARGET_OPTION_NAME + } ); + final String expectedOptionArgument = this.getMessage( "expectedOptionArgument", new Object[] + { + supportedTargets.append( ']' ).toString() + } ); + + throw new BadCommandLineException( missingOptionArgument + " " + expectedOptionArgument ); } final String targetArg = args[i + 1].trim(); @@ -257,11 +291,12 @@ if ( !supported ) { - throw new BadCommandLineException( this.getMessage( "badOption", new Object[] + final String expectedOptionArgument = this.getMessage( "expectedOptionArgument", new Object[] { - TARGET_OPTION_NAME, supportedTargets.append( ']' ).toString() - } ) ); + supportedTargets.append( ']' ).toString() + } ); + throw new BadCommandLineException( expectedOptionArgument ); } if ( targetArg.equals( "1.5" ) ) @@ -512,27 +547,34 @@ return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } - private JInvocation getCopyOfBytesInvocation( final ClassOutline classOutline ) + private JExpression getCopyOfPrimitiveArrayExpression( final ClassOutline classOutline, final JClass arrayType, + final JExpression source ) { - final JClass byteArray = classOutline.parent().getCodeModel().ref( byte[].class ); + if ( this.isTargetSupported( TARGET_1_6 ) ) + { + final JClass arrays = classOutline.parent().getCodeModel().ref( Arrays.class ); + return JOp.cond( source.eq( JExpr._null() ), JExpr._null(), arrays.staticInvoke( "copyOf" ). + arg( source ).arg( source.ref( "length" ) ) ); + + } + final JClass array = classOutline.parent().getCodeModel().ref( Array.class ); final JClass system = classOutline.parent().getCodeModel().ref( System.class ); - final JType[] signature = - { - byteArray - }; - - final String methodName = "copyOfBytes"; final int mod = this.getVisibilityModifier(); + final String methodName = "copyOf"; if ( mod != JMod.PRIVATE ) { for ( JMethod m : classOutline._package().objectFactory().methods() ) { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) + if ( m.name().equals( methodName ) ) { - return classOutline._package().objectFactory().staticInvoke( m ); + final JType[] signature = m.listParamTypes(); + if ( signature.length == 1 && signature[0].binaryName().equals( arrayType.binaryName() ) ) + { + return classOutline._package().objectFactory().staticInvoke( m ).arg( source ); + } } } } @@ -540,58 +582,53 @@ { for ( JMethod m : classOutline.implClass.methods() ) { - if ( m.name().equals( methodName ) && m.hasSignature( signature ) ) + if ( m.name().equals( methodName ) ) { - return JExpr.invoke( m ); + final JType[] signature = m.listParamTypes(); + if ( signature.length == 1 && signature[0].binaryName().equals( arrayType.binaryName() ) ) + { + return JExpr.invoke( m ).arg( source ); + } } } } final JMethod m = ( mod != JMod.PRIVATE - ? classOutline._package().objectFactory().method( JMod.STATIC | mod, byteArray, methodName ) - : classOutline.implClass.method( JMod.STATIC | mod, byteArray, methodName ) ); + ? classOutline._package().objectFactory().method( JMod.STATIC | mod, arrayType, methodName ) + : classOutline.implClass.method( JMod.STATIC | mod, arrayType, methodName ) ); - final JVar bytes = m.param( JMod.FINAL, byteArray, "bytes" ); + final JVar arrayParam = m.param( JMod.FINAL, arrayType, "array" ); - m.javadoc().append( "Creates and returns a copy of a given array of bytes." ); - m.javadoc().addParam( bytes ).append( "The array to copy or {@code null}." ); + m.javadoc().append( "Creates and returns a copy of a given array." ); + m.javadoc().addParam( arrayParam ).append( "The array to copy or {@code null}." ); m.javadoc().addReturn().append( - "A copy of {@code bytes} or {@code null} if {@code bytes} is {@code null}." ); + "A copy of {@code array} or {@code null} if {@code array} is {@code null}." ); m.body().directStatement( "// " + this.getMessage( "title", null ) ); - if ( this.isTargetSupported( TARGET_1_6 ) ) - { - final JClass arrays = classOutline.parent().getCodeModel().ref( Arrays.class ); - m.body()._return( JOp.cond( bytes.eq( JExpr._null() ), JExpr._null(), arrays.staticInvoke( "copyOf" ). - arg( bytes ).arg( bytes.ref( "length" ) ) ) ); + final JConditional arrayNotNull = m.body()._if( arrayParam.ne( JExpr._null() ) ); + final JVar copy = arrayNotNull._then().decl( + JMod.FINAL, arrayType, "copy", JExpr.cast( arrayType, array.staticInvoke( "newInstance" ).arg( + arrayParam.invoke( "getClass" ).invoke( "getComponentType" ) ).arg( arrayParam.ref( "length" ) ) ) ); - } - else - { - final JConditional bytesNotNull = m.body()._if( bytes.ne( JExpr._null() ) ); - final JVar copy = bytesNotNull._then().decl( - JMod.FINAL, byteArray, "copy", JExpr.cast( byteArray, array.staticInvoke( "newInstance" ).arg( - bytes.invoke( "getClass" ).invoke( "getComponentType" ) ).arg( bytes.ref( "length" ) ) ) ); + arrayNotNull._then().add( system.staticInvoke( "arraycopy" ).arg( arrayParam ).arg( JExpr.lit( 0 ) ). + arg( copy ).arg( JExpr.lit( 0 ) ).arg( arrayParam.ref( "length" ) ) ); - bytesNotNull._then().add( system.staticInvoke( "arraycopy" ).arg( bytes ).arg( JExpr.lit( 0 ) ). - arg( copy ).arg( JExpr.lit( 0 ) ).arg( bytes.ref( "length" ) ) ); + arrayNotNull._then()._return( copy ); - bytesNotNull._then()._return( copy ); + m.body()._return( JExpr._null() ); - m.body()._return( JExpr._null() ); - } + this.methodCount = this.methodCount.add( BigInteger.ONE ); + return ( mod != JMod.PRIVATE ? classOutline._package().objectFactory().staticInvoke( m ).arg( source ) + : JExpr.invoke( m ).arg( source ) ); - this.methodCount = this.methodCount.add( BigInteger.ONE ); - return ( mod != JMod.PRIVATE ? classOutline._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } private JInvocation getCopyOfArrayInvocation( final ClassOutline clazz ) { final JClass object = clazz.parent().getCodeModel().ref( Object.class ); final JClass array = clazz.parent().getCodeModel().ref( Array.class ); - final JClass byteArray = clazz.parent().getCodeModel().ref( byte[].class ); final JType[] signature = { @@ -635,19 +672,26 @@ m.body().directStatement( "// " + this.getMessage( "title", null ) ); final JConditional arrayNotNull = m.body()._if( arrayArg.ne( JExpr._null() ) ); - final JConditional isArrayOfBytes = - arrayNotNull._then()._if( arrayArg.invoke( "getClass" ).eq( byteArray.dotclass() ) ); - isArrayOfBytes._then()._return( - this.getCopyOfBytesInvocation( clazz ).arg( JExpr.cast( byteArray, arrayArg ) ) ); + for ( Class a : PRIMITIVE_ARRAY_TYPES ) + { + final JClass primitiveArray = clazz.parent().getCodeModel().ref( a ); + final JConditional isArrayOfPrimitive = + arrayNotNull._then()._if( arrayArg.invoke( "getClass" ).eq( primitiveArray.dotclass() ) ); - final JVar len = isArrayOfBytes._else().decl( - JMod.FINAL, clazz.parent().getCodeModel().INT, "len", array.staticInvoke( "getLength" ).arg( arrayArg ) ); + isArrayOfPrimitive._then()._return( this.getCopyOfPrimitiveArrayExpression( + clazz, primitiveArray, JExpr.cast( primitiveArray, arrayArg ) ) ); - final JVar copy = isArrayOfBytes._else().decl( JMod.FINAL, object, "copy", array.staticInvoke( "newInstance" ). + } + + final JVar len = arrayNotNull._then().decl( + JMod.FINAL, clazz.parent().getCodeModel().INT, "len", array.staticInvoke( "getLength" ). + arg( arrayArg ) ); + + final JVar copy = arrayNotNull._then().decl( JMod.FINAL, object, "copy", array.staticInvoke( "newInstance" ). arg( arrayArg.invoke( "getClass" ).invoke( "getComponentType" ) ).arg( len ) ); - final JForLoop forEachRef = isArrayOfBytes._else()._for(); + final JForLoop forEachRef = arrayNotNull._then()._for(); final JVar i = forEachRef.init( clazz.parent().getCodeModel().INT, "i", len.minus( JExpr.lit( 1 ) ) ); forEachRef.test( i.gte( JExpr.lit( 0 ) ) ); forEachRef.update( i.decr() ); @@ -655,7 +699,7 @@ arg( this.getCopyOfObjectInvocation( clazz ).arg( array.staticInvoke( "get" ). arg( arrayArg ).arg( i ) ) ) ); - isArrayOfBytes._else()._return( copy ); + arrayNotNull._then()._return( copy ); m.body()._return( JExpr._null() ); this.methodCount = this.methodCount.add( BigInteger.ONE ); return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); @@ -738,8 +782,12 @@ final JVar objectInput = tryClone.body().decl( JMod.FINAL, objectInputStream, "in", JExpr._new( objectInputStream ).arg( byteArrayInput ) ); - tryClone.body()._return( JExpr.cast( serializable, objectInput.invoke( "readObject" ) ) ); + final JVar copy = tryClone.body().decl( + JMod.FINAL, serializable, "copy", JExpr.cast( serializable, objectInput.invoke( "readObject" ) ) ); + tryClone.body().invoke( objectInput, "close" ); + tryClone.body()._return( copy ); + final JExpression assertionErrorMsg = JExpr.lit( "Unexpected instance during copying object '" ).plus( s ).plus( JExpr.lit( "'." ) ); @@ -841,13 +889,21 @@ isArray._then()._return( this.getCopyOfArrayInvocation( clazz ).arg( o ) ); - for ( String immutableName : IMMUTABLE_NAMES ) + for ( Class immutableType : IMMUTABLE_TYPES ) { - objectNotNull._then()._if( o._instanceof( clazz.parent().getCodeModel().ref( immutableName ) ) ). + objectNotNull._then()._if( o._instanceof( clazz.parent().getCodeModel().ref( immutableType ) ) ). _then()._return( o ); } + for ( Class cloneableType : CLONEABLE_TYPES ) + { + final JClass cloneable = clazz.parent().getCodeModel().ref( cloneableType ); + objectNotNull._then()._if( o._instanceof( cloneable ) )._then()._return( + JExpr.invoke( JExpr.cast( cloneable, o ), ( "clone" ) ) ); + + } + final JConditional instanceOfDOMElement = objectNotNull._then()._if( o._instanceof( element ) ); instanceOfDOMElement._then()._return( JExpr.cast( element, JExpr.invoke( JExpr.cast( element, o ), "cloneNode" ).arg( JExpr.TRUE ) ) ); @@ -1553,7 +1609,8 @@ } else if ( type == CBuiltinLeafInfo.BASE64_BYTE_ARRAY ) { - expr = this.getCopyOfBytesInvocation( fieldOutline.parent() ).arg( source ); + final JClass byteArray = fieldOutline.parent().parent().getCodeModel().ref( byte[].class ); + expr = this.getCopyOfPrimitiveArrayExpression( fieldOutline.parent(), byteArray, source ); } else if ( type == CBuiltinLeafInfo.BIG_DECIMAL || type == CBuiltinLeafInfo.BIG_INTEGER || type == CBuiltinLeafInfo.STRING || type == CBuiltinLeafInfo.BOOLEAN || type == CBuiltinLeafInfo.INT || @@ -1703,6 +1760,11 @@ if ( field.type().isPrimitive() ) { paramNotNullBlock.assign( JExpr.refthis( field.name() ), o.ref( field ) ); + this.log( Level.WARNING, "fieldWithoutProperties", new Object[] + { + field.name(), clazz.implClass.name() + } ); + } else { @@ -1714,14 +1776,14 @@ } else { + paramNotNullBlock.assign( JExpr.refthis( field.name() ), JExpr.cast( + field.type(), this.getCopyOfObjectInvocation( clazz ).arg( o.ref( field ) ) ) ); + this.log( Level.WARNING, "fieldWithoutProperties", new Object[] { field.name(), clazz.implClass.name() } ); - paramNotNullBlock.assign( JExpr.refthis( field.name() ), JExpr.cast( - field.type(), this.getCopyOfObjectInvocation( clazz ).arg( o.ref( field ) ) ) ); - } } } Modified: trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties =================================================================== --- trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-08-21 07:05:07 UTC (rev 73) +++ trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl.properties 2009-08-23 00:19:00 UTC (rev 74) @@ -12,9 +12,10 @@ title=CC-XJC Version ${pom.version} Build ${buildNumber} bugtrackerUrl=https://apps.sourceforge.net/mantisbt/ccxjc/ report={0,number} methods - {1,number} constructors - {2,number} expressions -badOption=Missing argument to {0} option. Expected one of {1}. visibilityReport=Creating methods using ''{0}'' visibility. visibilityUsage=CC-XJC: controls the visibility of copy methods ([private, package, protected, public]). Default: private targetUsage=CC-XJC: controls the target JDK ([1.5, 1.6, 1.7]). Default: 1.5 fieldWithoutProperties=Field ''{0}'' of class ''{1}'' has no properties. cannotCopyType=Cannot copy type ''{0}'' of property ''{1}'' of class ''{2}''. Copies reference. +missingOptionArgument=Missing argument to ''{0}'' option. +expectedOptionArgument=Expected one of {0}. Modified: trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties =================================================================== --- trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-08-21 07:05:07 UTC (rev 73) +++ trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_de.properties 2009-08-23 00:19:00 UTC (rev 74) @@ -12,9 +12,10 @@ title=CC-XJC Version ${pom.version} Build ${buildNumber} bugtrackerUrl=https://apps.sourceforge.net/mantisbt/ccxjc/ report={0,number} Methoden - {1,number} Konstruktoren - {2,number} Ausdr\u00FCcke -badOption={0} Option erwartet {1} Argument. visibilityReport=Erstellt Methoden mit ''{0}'' Sichtbarkeit. visibilityUsage=CC-XJC: steuert die Sichtbarkeit von Kopier-Methoden ([private, package, protected, public]). Standard: private targetUsage=CC-XJC: steuert das Ziel-JDK ([1.5, 1.6, 1.7]). Standard: 1.5 fieldWithoutProperties=Feld ''{0}'' der Klasse ''{1}'' hat keine Eigenschaften. cannotCopyType=Typ ''{0}'' der ''{1}'' Eigenschaft der Klasse ''{2}'' kann nicht kopiert werden. Kopiert Referenz. +missingOptionArgument=Fehlendes Argument f\u00FCr ''{0}'' Option. +expectedOptionArgument=Erwartet {0}. Modified: trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties =================================================================== --- trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-08-21 07:05:07 UTC (rev 73) +++ trunk/cc-xjc-plugin/src/main/resources/net/sourceforge/ccxjc/PluginImpl_en.properties 2009-08-23 00:19:00 UTC (rev 74) @@ -12,9 +12,10 @@ title=CC-XJC Version ${pom.version} Build ${buildNumber} bugtrackerUrl=https://apps.sourceforge.net/mantisbt/ccxjc/ report={0,number} methods - {1,number} constructors - {2,number} expressions -badOption=Missing argument to {0} option. Expected one of {1}. visibilityReport=Creating methods using ''{0}'' visibility. visibilityUsage=CC-XJC: controls the visibility of copy methods ([private, package, protected, public]). Default: private targetUsage=CC-XJC: controls the target JDK ([1.5, 1.6, 1.7]). Default: 1.5 fieldWithoutProperties=Field ''{0}'' of class ''{1}'' has no properties. cannotCopyType=Cannot copy type ''{0}'' of property ''{1}'' of class ''{2}''. Copies reference. +missingOptionArgument=Missing argument to ''{0}'' option. +expectedOptionArgument=Expected one of {0}. Modified: trunk/src/main/changes/changes.xml =================================================================== --- trunk/src/main/changes/changes.xml 2009-08-21 07:05:07 UTC (rev 73) +++ trunk/src/main/changes/changes.xml 2009-08-23 00:19:00 UTC (rev 74) @@ -141,5 +141,17 @@ </action> </release> + <!-- ******************************************************************* --> + <release version="1.0-beta-11" date="2009-08-23"> + <action dev="schulte2005" type="updated"><![CDATA[ + Updated generated <code>copyOfObject</code> methods to support copying of + <code>XMLGregorianCalendar</code> instances without using reflection.]]> + </action> + <action dev="schulte2005" type="updated"><![CDATA[ + Updated generated <code>copyOfArray</code> methods to support copying of + primitive arrays without using reflection.]]> + </action> + </release> + </body> </document> Modified: trunk/src/site/apt/download.apt =================================================================== --- trunk/src/site/apt/download.apt 2009-08-21 07:05:07 UTC (rev 73) +++ trunk/src/site/apt/download.apt 2009-08-23 00:19:00 UTC (rev 74) @@ -39,24 +39,11 @@ * Releases - Releases are deployed to the CC-XJC release repository and to the + Releases are deployed to the central Maven 2 repository and to the {{{http://sourceforge.net/projects/ccxjc/files/}Sourceforge file release system}}. The {{{http://ccxjc.sourceforge.net/changes-report.html}changes report}} contains information regarding changes between releases. ---- -<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> ---- - * Snapshots Development snapshots are deployed to the CC-XJC snapshot repository and Modified: trunk/src/site/apt/examples.apt =================================================================== --- trunk/src/site/apt/examples.apt 2009-08-21 07:05:07 UTC (rev 73) +++ trunk/src/site/apt/examples.apt 2009-08-23 00:19:00 UTC (rev 74) @@ -40,26 +40,10 @@ * 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. + choice. The following example demonstrates the use of the CC-XJC plugin with + the Java.net maven-jaxb-plugin. --- -<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> @@ -68,12 +52,12 @@ <dependency> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc-plugin</artifactId> - <version>1.0-beta-10</version> + <version>1.0-beta-11</version> </dependency> </dependencies> <executions> <execution> - <id>generate</id> + <id>xjc</id> <phase>generate-sources</phase> <goals> <goal>generate</goal> @@ -88,8 +72,8 @@ </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. + Note: To use the Java.net maven-jaxb-plugin the Java.net repositories + need to be configured in a POM or the Maven settings. --- <repositories> Modified: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt 2009-08-21 07:05:07 UTC (rev 73) +++ trunk/src/site/apt/index.apt 2009-08-23 00:19:00 UTC (rev 74) @@ -47,9 +47,9 @@ * -cc-visibility The '-cc-visibility' option can be used to specify the visibility of - generated helper methods. It takes one argument from the list + generated copy methods. It takes one argument from the list [private, package, protected, public]. This option impacts the number of - generated helper methods. Default: private. + generated methods. Default: private. * -cc-target This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-23 00:38:10
|
Revision: 75 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=75&view=rev Author: schulte2005 Date: 2009-08-23 00:38:01 +0000 (Sun, 23 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare release cc-xjc-1.0-beta-11 Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-23 00:19:00 UTC (rev 74) +++ trunk/cc-xjc-dist/pom.xml 2009-08-23 00:38:01 UTC (rev 75) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-11-SNAPSHOT</version> + <version>1.0-beta-11</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-23 00:19:00 UTC (rev 74) +++ trunk/cc-xjc-it/pom.xml 2009-08-23 00:38:01 UTC (rev 75) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-11-SNAPSHOT</version> + <version>1.0-beta-11</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-23 00:19:00 UTC (rev 74) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-23 00:38:01 UTC (rev 75) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-11-SNAPSHOT</version> + <version>1.0-beta-11</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-23 00:19:00 UTC (rev 74) +++ trunk/pom.xml 2009-08-23 00:38:01 UTC (rev 75) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-11-SNAPSHOT</version> + <version>1.0-beta-11</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-11</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-11</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-11</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-23 00:38:46
|
Revision: 77 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=77&view=rev Author: schulte2005 Date: 2009-08-23 00:38:38 +0000 (Sun, 23 Aug 2009) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/cc-xjc-dist/pom.xml trunk/cc-xjc-it/pom.xml trunk/cc-xjc-plugin/pom.xml trunk/pom.xml Modified: trunk/cc-xjc-dist/pom.xml =================================================================== --- trunk/cc-xjc-dist/pom.xml 2009-08-23 00:38:22 UTC (rev 76) +++ trunk/cc-xjc-dist/pom.xml 2009-08-23 00:38:38 UTC (rev 77) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-11</version> + <version>1.0-beta-12-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-dist</artifactId> Modified: trunk/cc-xjc-it/pom.xml =================================================================== --- trunk/cc-xjc-it/pom.xml 2009-08-23 00:38:22 UTC (rev 76) +++ trunk/cc-xjc-it/pom.xml 2009-08-23 00:38:38 UTC (rev 77) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-11</version> + <version>1.0-beta-12-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-it</artifactId> Modified: trunk/cc-xjc-plugin/pom.xml =================================================================== --- trunk/cc-xjc-plugin/pom.xml 2009-08-23 00:38:22 UTC (rev 76) +++ trunk/cc-xjc-plugin/pom.xml 2009-08-23 00:38:38 UTC (rev 77) @@ -34,7 +34,7 @@ <parent> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc</artifactId> - <version>1.0-beta-11</version> + <version>1.0-beta-12-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cc-xjc-plugin</artifactId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-23 00:38:22 UTC (rev 76) +++ trunk/pom.xml 2009-08-23 00:38:38 UTC (rev 77) @@ -36,7 +36,7 @@ <artifactId>cc-xjc</artifactId> <packaging>pom</packaging> <name>CC-XJC</name> - <version>1.0-beta-11</version> + <version>1.0-beta-12-SNAPSHOT</version> <description>JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes.</description> <url>http://ccxjc.sourceforge.net</url> <inceptionYear>2009</inceptionYear> @@ -78,9 +78,9 @@ </mailingList> </mailingLists> <scm> - <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-11</connection> - <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/tags/cc-xjc-1.0-beta-11</developerConnection> - <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/tags/cc-xjc-1.0-beta-11</url> + <connection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</connection> + <developerConnection>scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk</developerConnection> + <url>http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk</url> </scm> <build> <pluginManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sch...@us...> - 2009-08-23 16:46:26
|
Revision: 78 http://ccxjc.svn.sourceforge.net/ccxjc/?rev=78&view=rev Author: schulte2005 Date: 2009-08-23 16:46:19 +0000 (Sun, 23 Aug 2009) Log Message: ----------- o Corrected generated copyOfXYZElement methods. Modified Paths: -------------- trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java trunk/src/main/changes/changes.xml trunk/src/site/apt/examples.apt Modified: trunk/cc-xjc-it/src/main/schemas/cc-xjc-it.xsd =================================================================== (Binary files differ) Modified: trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java =================================================================== --- trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-23 00:38:38 UTC (rev 77) +++ trunk/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java 2009-08-23 16:46:19 UTC (rev 78) @@ -971,16 +971,26 @@ return ( mod != JMod.PRIVATE ? clazz._package().objectFactory().staticInvoke( m ) : JExpr.invoke( m ) ); } - private JInvocation getCopyOfClassInfoElementInvocation( final FieldOutline fieldOutline, final CNonElement type ) + private JInvocation getCopyOfElementInfoInvocation( final FieldOutline fieldOutline, final CElementInfo element ) { - final JType jaxbElement = fieldOutline.parent().parent().getCodeModel().ref( JAXBElement.class ); - final JType javaType = type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ); + final JType elementType = element.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ); final JType[] signature = { - jaxbElement + elementType }; - final String methodName = "copyOf" + this.getMethodNamePart( javaType ) + "Element"; + final String methodName; + if ( element.hasClass() ) + { + methodName = "copyOf" + element.shortName(); + } + else + { + methodName = "copyOf" + this.getMethodNamePart( + element.getContentType().toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ) ) + "Element"; + + } + final int mod = this.getVisibilityModifier(); if ( mod != JMod.PRIVATE ) @@ -1006,13 +1016,13 @@ final JMethod m = ( mod != JMod.PRIVATE - ? fieldOutline.parent()._package().objectFactory().method( JMod.STATIC | mod, jaxbElement, methodName ) - : fieldOutline.parent().implClass.method( JMod.STATIC | mod, jaxbElement, methodName ) ); + ? fieldOutline.parent()._package().objectFactory().method( JMod.STATIC | mod, elementType, methodName ) + : fieldOutline.parent().implClass.method( JMod.STATIC | mod, elementType, methodName ) ); - final JVar e = m.param( JMod.FINAL, jaxbElement, "e" ); + final JVar e = m.param( JMod.FINAL, elementType, "e" ); - m.javadoc().append( "Creates and returns a copy of a given {@code JAXBElement<" + javaType.binaryName() + - ">} instance." ); + m.javadoc().append( "Creates and returns a copy of a given {@code " + elementType.binaryName() + + "} instance." ); m.javadoc().addParam( e ).append( "The instance to copy or {@code null}." ); m.javadoc().addReturn().append( "A copy of {@code e} or {@code null} if {@code e} is {@code null}." ); @@ -1021,17 +1031,37 @@ final JConditional elementNotNull = m.body()._if( e.ne( JExpr._null() ) ); - final JExpression newElement = JExpr._new( jaxbElement ). - arg( JExpr.invoke( e, "getName" ) ). - arg( JExpr.invoke( e, "getDeclaredType" ) ). - arg( JExpr.invoke( e, "getScope" ) ). - arg( JExpr.invoke( e, "getValue" ) ); + final JExpression newElement; + if ( element.hasClass() ) + { + newElement = JExpr._new( elementType ).arg( this.getCopyExpression( + fieldOutline, element.getContentType(), elementNotNull._then(), + JExpr.cast( element.getContentType().toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ), + JExpr.invoke( e, "getValue" ) ) ) ); - final JVar copy = elementNotNull._then().decl( jaxbElement, "copy", newElement ); + } + else + { + newElement = JExpr._new( elementType ). + arg( JExpr.invoke( e, "getName" ) ). + arg( JExpr.invoke( e, "getDeclaredType" ) ). + arg( JExpr.invoke( e, "getScope" ) ). + arg( JExpr.invoke( e, "getValue" ) ); + + } + + final JVar copy = elementNotNull._then().decl( JMod.FINAL, elementType, "copy", newElement ); elementNotNull._then().add( copy.invoke( "setNil" ).arg( e.invoke( "isNil" ) ) ); - elementNotNull._then().add( copy.invoke( "setValue" ).arg( this.getCopyExpression( - fieldOutline, type, elementNotNull._then(), JExpr.cast( javaType, copy.invoke( "getValue" ) ) ) ) ); + if ( !element.hasClass() ) + { + elementNotNull._then().add( copy.invoke( "setValue" ).arg( this.getCopyExpression( + fieldOutline, element.getContentType(), elementNotNull._then(), + JExpr.cast( element.getContentType().toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ), + copy.invoke( "getValue" ) ) ) ) ); + + } + elementNotNull._then()._return( copy ); m.body()._return( JExpr._null() ); this.methodCount = this.methodCount.add( BigInteger.ONE ); @@ -1054,7 +1084,7 @@ arrayType }; - final String methodName = "copyOf" + this.getMethodNamePart( arrayType ); + final String methodName = "copyOf" + fieldOutline.getPropertyInfo().getName( true ); final int mod = this.getVisibilityModifier(); if ( mod != JMod.PRIVATE ) @@ -1146,6 +1176,9 @@ final List<CElementInfo> referencedElementInfos = new ArrayList<CElementInfo>( field.getPropertyInfo().ref().size() ); + final List<CElementInfo> referencedElementInfosWithClass = + new ArrayList<CElementInfo>( field.getPropertyInfo().ref().size() ); + final List<CTypeInfo> referencedTypeInfos = new ArrayList<CTypeInfo>( field.getPropertyInfo().ref().size() ); @@ -1163,13 +1196,21 @@ if ( type instanceof CElementInfo ) { final CElementInfo e = (CElementInfo) type; - final JType contentType = e.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ); - - if ( !referencedContentTypes.contains( contentType ) ) + if ( e.hasClass() ) { - referencedContentTypes.add( contentType ); - referencedElementInfos.add( e ); + referencedElementInfosWithClass.add( e ); } + else + { + final JType contentType = + e.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + + if ( !referencedContentTypes.contains( contentType ) ) + { + referencedContentTypes.add( contentType ); + referencedElementInfos.add( e ); + } + } } else if ( type instanceof CClassInfo ) { @@ -1194,42 +1235,73 @@ } Collections.sort( referencedClassInfos, new CClassInfoComparator( field.parent().parent() ) ); - Collections.sort( referencedElementInfos, new CElementInfoComparator( field.parent().parent() ) ); + Collections.sort( referencedElementInfos, new CElementInfoComparator( field.parent().parent(), false ) ); + Collections.sort( referencedElementInfosWithClass, new CElementInfoComparator( field.parent().parent(), true ) ); Collections.sort( referencedTypeInfos, new CTypeInfoComparator( field.parent().parent() ) ); Collections.reverse( referencedClassInfos ); Collections.reverse( referencedElementInfos ); + Collections.reverse( referencedElementInfosWithClass ); Collections.reverse( referencedTypeInfos ); - if ( !referencedElementInfos.isEmpty() ) + if ( !( referencedElementInfos.isEmpty() && referencedElementInfosWithClass.isEmpty() ) ) { final JBlock elementBlock = sourceNotNull._then()._if( source._instanceof( jaxbElement ) )._then(); - - for ( CElementInfo elementInfo : referencedElementInfos ) + if ( !referencedElementInfosWithClass.isEmpty() ) { - final JType contentType = - ( elementInfo.getAdapterUse() != null ? field.parent().parent().getModel().getTypeInfo( - elementInfo.getAdapterUse().customType ).toType( field.parent().parent(), Aspect.IMPLEMENTATION ) - : elementInfo.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ) ); + elementBlock.directStatement( "// Referenced elements with classes." ); + for ( CElementInfo elementInfo : referencedElementInfosWithClass ) + { + final JType elementType = elementInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + final JConditional ifInstanceOf = elementBlock._if( source._instanceof( elementType ) ); + final JExpression copyExpr = this.getCopyExpression( + field, elementInfo, ifInstanceOf._then(), JExpr.cast( elementType, source ) ); - final JConditional ifInstanceOf = elementBlock._if( JExpr.invoke( JExpr.cast( - jaxbElement, source ), "getValue" )._instanceof( contentType ) ); + if ( copyExpr == null ) + { + this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName() + } ), null ); - final JExpression copyExpr = this.getCopyExpression( field, elementInfo, ifInstanceOf._then(), - JExpr.cast( jaxbElement, source ) ); + } + else + { + ifInstanceOf._then()._return( copyExpr ); + } + } + } - if ( copyExpr == null ) + if ( !referencedElementInfos.isEmpty() ) + { + elementBlock.directStatement( "// Referenced elements without classes." ); + for ( CElementInfo elementInfo : referencedElementInfos ) { - this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] - { - field.getPropertyInfo().getName( true ), - field.parent().implClass.binaryName() - } ), null ); + final JType contentType = + ( elementInfo.getAdapterUse() != null ? field.parent().parent().getModel().getTypeInfo( + elementInfo.getAdapterUse().customType ).toType( field.parent().parent(), Aspect.IMPLEMENTATION ) + : elementInfo.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ) ); + final JConditional ifInstanceOf = elementBlock._if( JExpr.invoke( JExpr.cast( + jaxbElement, source ), "getValue" )._instanceof( contentType ) ); + + final JExpression copyExpr = this.getCopyExpression( + field, elementInfo, ifInstanceOf._then(), JExpr.cast( jaxbElement, source ) ); + + if ( copyExpr == null ) + { + this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName() + } ), null ); + + } + else + { + ifInstanceOf._then()._return( copyExpr ); + } } - else - { - ifInstanceOf._then()._return( copyExpr ); - } } } @@ -1341,6 +1413,9 @@ final List<CElementInfo> referencedElementInfos = new ArrayList<CElementInfo>( field.getPropertyInfo().ref().size() ); + final List<CElementInfo> referencedElementInfosWithClass = + new ArrayList<CElementInfo>( field.getPropertyInfo().ref().size() ); + final List<CTypeInfo> referencedTypeInfos = new ArrayList<CTypeInfo>( field.getPropertyInfo().ref().size() ); @@ -1358,13 +1433,21 @@ if ( type instanceof CElementInfo ) { final CElementInfo e = (CElementInfo) type; - final JType contentType = e.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ); - - if ( !referencedContentTypes.contains( contentType ) ) + if ( e.hasClass() ) { - referencedContentTypes.add( contentType ); - referencedElementInfos.add( e ); + referencedElementInfosWithClass.add( e ); } + else + { + final JType contentType = + e.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + + if ( !referencedContentTypes.contains( contentType ) ) + { + referencedContentTypes.add( contentType ); + referencedElementInfos.add( e ); + } + } } else if ( type instanceof CClassInfo ) { @@ -1389,10 +1472,12 @@ } Collections.sort( referencedClassInfos, new CClassInfoComparator( field.parent().parent() ) ); - Collections.sort( referencedElementInfos, new CElementInfoComparator( field.parent().parent() ) ); + Collections.sort( referencedElementInfos, new CElementInfoComparator( field.parent().parent(), false ) ); + Collections.sort( referencedElementInfosWithClass, new CElementInfoComparator( field.parent().parent(), true ) ); Collections.sort( referencedTypeInfos, new CTypeInfoComparator( field.parent().parent() ) ); Collections.reverse( referencedClassInfos ); Collections.reverse( referencedElementInfos ); + Collections.reverse( referencedElementInfosWithClass ); Collections.reverse( referencedTypeInfos ); final JForLoop copyLoop; @@ -1420,7 +1505,7 @@ } else { - sourceNotEmpty = m.body()._if( JExpr.invoke( source, "isEmpty" ).ne( JExpr.TRUE ) ); + sourceNotEmpty = m.body()._if( JExpr.invoke( source, "isEmpty" ).not() ); copyLoop = sourceNotEmpty._then()._for(); it = copyLoop.init( field.parent().parent().getCodeModel().ref( Iterator.class ), "it", source.invoke( "iterator" ) ); @@ -1430,45 +1515,84 @@ copy = null; } - if ( !referencedElementInfos.isEmpty() ) + if ( !( referencedElementInfos.isEmpty() && referencedElementInfosWithClass.isEmpty() ) ) { final JBlock copyBlock = copyLoop.body()._if( next._instanceof( jaxbElement ) )._then(); - - for ( CElementInfo elementInfo : referencedElementInfos ) + if ( !referencedElementInfosWithClass.isEmpty() ) { - final JType contentType = - ( elementInfo.getAdapterUse() != null ? field.parent().parent().getModel().getTypeInfo( - elementInfo.getAdapterUse().customType ).toType( field.parent().parent(), Aspect.IMPLEMENTATION ) - : elementInfo.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ) ); + copyBlock.directStatement( "// Referenced elements with classes." ); + for ( CElementInfo elementInfo : referencedElementInfosWithClass ) + { + final JType elementType = elementInfo.toType( field.parent().parent(), Aspect.IMPLEMENTATION ); + final JConditional ifInstanceOf = copyBlock._if( next._instanceof( elementType ) ); + final JExpression copyExpr = this.getCopyExpression( + field, elementInfo, ifInstanceOf._then(), JExpr.cast( elementType, next ) ); - final JConditional ifInstanceOf = copyBlock._if( JExpr.invoke( JExpr.cast( - jaxbElement, next ), "getValue" )._instanceof( contentType ) ); + if ( copyExpr == null ) + { + this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName() + } ), null ); - final JExpression copyExpr = - this.getCopyExpression( field, elementInfo, ifInstanceOf._then(), JExpr.cast( jaxbElement, next ) ); - - if ( copyExpr == null ) - { - this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + } + else + { + if ( field.getRawType().isArray() ) { - field.getPropertyInfo().getName( true ), - field.parent().implClass.binaryName() - } ), null ); + ifInstanceOf._then().assign( copy.component( it ), copyExpr ); + } + else + { + ifInstanceOf._then().invoke( target, "add" ).arg( copyExpr ); + } + ifInstanceOf._then()._continue(); + } } - else + } + + if ( !referencedElementInfos.isEmpty() ) + { + copyBlock.directStatement( "// Referenced elements without classes." ); + for ( CElementInfo elementInfo : referencedElementInfos ) { - if ( field.getRawType().isArray() ) + final JType contentType = + ( elementInfo.getAdapterUse() != null ? field.parent().parent().getModel().getTypeInfo( + elementInfo.getAdapterUse().customType ).toType( field.parent().parent(), Aspect.IMPLEMENTATION ) + : elementInfo.getContentType().toType( field.parent().parent(), Aspect.IMPLEMENTATION ) ); + + final JConditional ifInstanceOf = copyBlock._if( JExpr.invoke( JExpr.cast( + jaxbElement, next ), "getValue" )._instanceof( contentType ) ); + + final JExpression copyExpr = + this.getCopyExpression( field, elementInfo, ifInstanceOf._then(), + JExpr.cast( jaxbElement, next ) ); + + if ( copyExpr == null ) { - ifInstanceOf._then().assign( copy.component( it ), copyExpr ); + this.log( Level.SEVERE, this.getMessage( "cannotCopyProperty", new Object[] + { + field.getPropertyInfo().getName( true ), + field.parent().implClass.binaryName() + } ), null ); + } else { - ifInstanceOf._then().invoke( target, "add" ).arg( copyExpr ); + if ( field.getRawType().isArray() ) + { + ifInstanceOf._then().assign( copy.component( it ), copyExpr ); + } + else + { + ifInstanceOf._then().invoke( target, "add" ).arg( copyExpr ); + } } + + ifInstanceOf._then()._continue(); } - - ifInstanceOf._then()._continue(); } } @@ -1692,7 +1816,7 @@ block.directStatement( "// CElementInfo: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); - return this.getCopyOfClassInfoElementInvocation( fieldOutline, type.getContentType() ).arg( source ); + return this.getCopyOfElementInfoInvocation( fieldOutline, type ).arg( source ); } private JExpression getEnumLeafInfoCopyExpression( final FieldOutline fieldOutline, final CEnumLeafInfo type, @@ -1899,6 +2023,8 @@ { methodName = methodName.replace( "[]", "s" ); } + + methodName = methodName.replace( ".", "" ); final char[] c = methodName.toCharArray(); c[0] = Character.toUpperCase( c[0] ); methodName = String.valueOf( c ); @@ -1983,16 +2109,30 @@ private final Outline outline; - CElementInfoComparator( final Outline outline ) + private final boolean hasClass; + + CElementInfoComparator( final Outline outline, final boolean hasClass ) { this.outline = outline; + this.hasClass = hasClass; } public int compare( final CElementInfo o1, final CElementInfo o2 ) { - final JClass javaClass1 = (JClass) o1.getContentType().toType( this.outline, Aspect.IMPLEMENTATION ); - final JClass javaClass2 = (JClass) o2.getContentType().toType( this.outline, Aspect.IMPLEMENTATION ); + final JClass javaClass1; + final JClass javaClass2; + if ( this.hasClass ) + { + javaClass1 = (JClass) o1.toType( this.outline, Aspect.IMPLEMENTATION ); + javaClass2 = (JClass) o2.toType( this.outline, Aspect.IMPLEMENTATION ); + } + else + { + javaClass1 = (JClass) o1.getContentType().toType( this.outline, Aspect.IMPLEMENTATION ); + javaClass2 = (JClass) o2.getContentType().toType( this.outline, Aspect.IMPLEMENTATION ); + } + int ret = 0; if ( !javaClass1.binaryName().equals( javaClass2.binaryName() ) ) Modified: trunk/src/main/changes/changes.xml =================================================================== --- trunk/src/main/changes/changes.xml 2009-08-23 00:38:38 UTC (rev 77) +++ trunk/src/main/changes/changes.xml 2009-08-23 16:46:19 UTC (rev 78) @@ -143,15 +143,22 @@ <!-- ******************************************************************* --> <release version="1.0-beta-11" date="2009-08-23"> - <action dev="schulte2005" type="updated"><![CDATA[ + <action dev="schulte2005" type="update"><![CDATA[ Updated generated <code>copyOfObject</code> methods to support copying of <code>XMLGregorianCalendar</code> instances without using reflection.]]> </action> - <action dev="schulte2005" type="updated"><![CDATA[ + <action dev="schulte2005" type="update"><![CDATA[ Updated generated <code>copyOfArray</code> methods to support copying of primitive arrays without using reflection.]]> </action> </release> + <!-- ******************************************************************* --> + <release version="1.0-beta-12" date="2009-08-24"> + <action dev="schulte2005" type="fix"><![CDATA[ + Corrected generated <code>copyOfXYZElement</code> methods.]]> + </action> + </release> + </body> </document> Modified: trunk/src/site/apt/examples.apt =================================================================== --- trunk/src/site/apt/examples.apt 2009-08-23 00:38:38 UTC (rev 77) +++ trunk/src/site/apt/examples.apt 2009-08-23 16:46:19 UTC (rev 78) @@ -52,7 +52,7 @@ <dependency> <groupId>net.sourceforge.ccxjc</groupId> <artifactId>cc-xjc-plugin</artifactId> - <version>1.0-beta-11</version> + <version>1.0-beta-12</version> </dependency> </dependencies> <executions> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |