...
Code Block |
---|
|
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 |
---|
|
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 |
---|
|
<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>
|