users@jaxb.java.net

Re: global customization in Java-first approach

From: Joost Cassee <joost_at_cassee.net>
Date: Fri, 23 Feb 2007 08:44:51 +0100

On 21/02/2007 20:48, Levi Purvis wrote:

> Does anyone know of a way to apply global customization patterns in
> the Java-first approach? Or a plug-in point to create an extension
> for this?
>
> For example, lets say I always wanted my schema types to start with a
> capital letter. Currently, I'd do this:
>
> @XmlType(name="Foo")
> class Foo {}
>
> @XmlType(name="Bar")
> class Bar {}
>
> Instead of adding these annotations to every class, I'd rather create
> a "plug-in" that changes the default behavior. Is anything like this
> possible with the Java-first approach?
>
> I'd like to do the same thing with Collections, make them always
> include an implicit @XmlElementWrapper.

Writing a plugin is not so hard. There are a number of them at
https://jaxb2-commons.dev.java.net/. The CamelCase Always plugin comes
close to your first question.

These plugins customize the marshalling process directly, though, they
do not generate annotations.


Regards,

Joost

-- 
Joost Cassee
http://joost.cassee.net