users@jaxb.java.net

Re: toString() methods on generated classes

From: Hanson Char <hanson.char_at_gmail.com>
Date: Wed, 13 Sep 2006 16:54:36 -0700

Thinking about the toString() method in jaxb generated classes, one
obvious/easy approach is to generate one (eg via plugin) to make use of the
jarkata commons' ToStringBuilder.reflectionToString(...) method.

How about the thought of defining a toXml() to return the xml string of the
current jaxb pojo instance ? AFAIK, such toXml() can be easily/nicely done
using XStream ... But how about the idea of using jaxb marshaller instead ?
Is speed or validation a concern ? (XStream does no validation.)

In both instances the generated source would likely to incur extra jar
dependencies.

I don't mind to integrate these extra methods into the fluent-api plugin, if
this is considered sensible.

Thoughts ?

Hanson

On 9/13/06, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
>
> Hanson Char wrote:
> > Write your own jaxb plugin ?
>
> +1. And if someone is willing to work on it, please let us know so that
> we can host it at http://jaxb2-commons.dev.java.net/
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>