users@jaxb.java.net

Re: toString() methods on generated classes

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 14 Sep 2006 12:04:36 -0700

Hanson Char wrote:
> Wouldn't it be nice to let CodeModel "register" some "direct" imports, so
> that it can have them appended to the import-set when it's ready to do so ?

I generally recommend against using the direct statements, since it's
inherently unasfe. But since it's there, so perhaps adding something
like what you've suggested probably wouldn't really make anything unsafe-r.

So yeah, I guess we can do so. It's just that you should know it might
break sometime, when the generated class names collide with the classes
you use.

>> say, commons-lang-toString plugin and/or xstream-toXml plugin?
>
> Hmm ... but wouldn't that lead to a plugin proliferation problem ? How
> about the alternative of something like commons-lang-plugin or
> xstream-plugin, which would be less specific but still imply the stuff being
> used. So commons-lang can be used for implementing toString() or hashCode()
> or equal, etc., as configured by the plugin user.

Yeah. Sounds good to me.

Commons-lang and xstream are certainly specific enough that people can
imagine what kind of features that plugin might have. But if poorly
chosen, it could be confusing, like, say, jakarta-plugin.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com