Tag Archive

Changing JAXB-generated adapter classes

Published on January 2, 2011 By Steve Perkins

The ability to specify naming for generated adapter classes was requested in 2008, but it doesn’t look like anything’s been done with it since. Being able to specify naming would have solved my problem completely – I just needed to either put the generated default adapters into a custom package or give each adapter a custom prefix or postfix. In this case, XJC Vendor Customizations came to the rescue! This post at retep.org helped elucidate usage.

Using the Vendor Customization allows you to reuse JAXB adapters, decreasing overall JAR file size (by removing duplicate generated adapters) and permgen usage. As an added bonus the syntax is simpler yet still understandable.