users@jaxb.java.net

Re: toString

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Sun, 12 Jan 2003 07:10:23 -0800

Unfortunately, it is not so easy to put your own code to the generated
classes.

One possibility is that we are going to have a JAXB RI-specific vendor
extention that allows you to specify the root class of all the generated
classes. So you can use this functionality to set the following class as
the root class.

class MyRootClass
{
    public String toString() {
        ...
    }
}

But (1) this will lock you into JAXB RI, (2) this functionality is not
available in beta, and (3) it's very awkward to access member variables
in this way.


I'm not terribly familiar with JTree, but another possibility might be
to write a wrapper class for JTree.

class JTreeWrapper
{
    public final XYZ wrappedObject;

    public String toString() {
        ...
    }
}



regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com