Search code examples
javaxmlmavenjaxbgenerated

generally change JaxB class name mapping


I have a fairly big xsd from which I generate JaxB classes using the org.jvnet.jaxb2.maven2.maven-jaxb2-plugin. The element names are all capital letters delimited by underscores like FOO_BAR_BAZ. This results in hideous names for the generated classes e.g. FOOBARBAZ. Idealy I would like it to be maped to FooBarBaz. Extending the definition with <jxb:class> Elements isn't an option.

Is there a general way to override how jaxb maps element names to java class names?


Solution

  • For this use case you could investigate creating a custom XJC plug-in to customize how the Java class names are derived.