Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
java
java
    public String getBackground() {
        if (null == background) {
            return "red";
        }
        return background;
    }

    public String getForeground() {
        if (null == foreground) {
            return "blue";
        }
        return foreground;
    }

Normally, XJC would just generate code like:

Code Block
java
java

    public String getBackground() {
        return background;
    }

    public String getForeground() {
        return foreground;
    }

so code that works with the beans need to take the possible null return into account.

To use with Maven

Code Block
xml
xml

           <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-xjc-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>xsdtojava</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <xsdOptions>
                        <xsdOption>
                            <extension>true</extension>
                            <xsd>${basedir}/src/main/resources/schemas/configuration/foo.xsd</xsd>
                            <extensionArgs>
                                <arg>-Xdv</arg>
                            </extensionArgs>
                        </xsdOption>
                    </xsdOptions>
                    <extensions>
                        <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.3.0</extension>
                    </extensions>
                </configuration>
            </plugin>