users@jaxb.java.net

Supplying a custom CodeWriter

From: Peter Hendry <peter.hendry_at_capeclear.com>
Date: Tue, 04 Dec 2007 23:27:04 +1300

I find the need to control where/how things are written by the
CodeWriter so I'd like to be able to supply my own class that implements
the CodeWriter interface. Looking at the Driver class (and OptionsEx) I
can't see how I could hook in a custom CodeWriter. OptionsEx is created
by Driver with no way to override it, and Driver calls
OptionsEx.createCodeWriter() which has a hard-coded codewriter
implementation it creates.

This means I can't supply a custom OptionsEx to override
createCodeWriter() and I can't set some property/argument to have
OptionsEx use a different class.

Any pointers? It seems like a deliberate (good) decision to pull out the
functionality for controlling where/how an OutputStream/Writer is
created for each class but seems odd that this functionality cannot be
customized with a custom implementation. Is this just a configuration
oversight?

Is there another class other than Driver that I should be looking at for
doing Schema to Java?

Pete