Skip to content

A XJC plugin to make getters of optional properties Optional.

Notifications You must be signed in to change notification settings

raphw/xjcoptional

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This plugin changes getters for properties that are not optional singletons in an XSD file (minOccurs = 0 and maxOccurs = 1) to return an Optional value.

Example use in Maven when building with the maven-jaxb2-plugin:

<build>
  <plugins>
    <plugin>
      <groupId>org.jvnet.jaxb2.maven2</groupId>
      <artifactId>maven-jaxb2-plugin</artifactId>
      <version>LATEST</version>
      <executions>
        <execution>
          <id>xsd-generate</id>
          <phase>generate-sources</phase>
          <goals>
            <goal>generate</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <extension>true</extension>
	<args>
	  <arg>-Xnullsafegetters</arg>
        </args>
        <plugins>
          <plugin>
            <groupId>codes.rafael.xjc</groupId>
            <artifactId>nullsafe</artifactId>
            <version>LATEST</version>
          </plugin>
        </plugins>
      </configuration>
    </plugin>
  </plugins>
</build>

Under the Apache 2.0 license.

About

A XJC plugin to make getters of optional properties Optional.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages