users@jaxb.java.net

Re: [HJ3] How can i transfer the extendedCloneable plugin from HJ2 to HJ3?

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 29 Jan 2007 12:02:36 -0800

Aleksei Valikov wrote:
> I have implemented the "copyable" plugin in jaxb2-commons/basic. It produces two
> copyTo methods:

Cool! Would you be able to also quickly put www/basic/index.html and
link from the top page?

>
> public Object copyTo(Object target, CopyBuilder copyBuilder)
> {
> ....
> }
>
> public Object copyTo(Object target)
> {
> final CopyBuilder copyBuilder = new JAXBCopyBuilder();
> return copyTo(target, copyBuilder);
> }
>
> The second method simply calls the first one with a certain copyBuilder. Class
> of the copyBuilder is configurable within the plugin. This copyBuilder is the
> object responsible for the copying strategy. Currently, JAXBCopyBuilder makes
> trivial deep copying (no cycles detection or checks if the object was already
> copied etc.).
> For the functionality similar to "extendedCloneable" you'll simply need to
> implement an appropriate copy builder and configure it withing the plugin when
> you invoke it. Or we can add there some kind of a switch or whatever.
>
> ps. There are also hashCode, equals and toString plugins implemented in a
> similar manner: the function strategy is extracted into a special "builder",
> which can be provided externally. If it's not provided, a default JAXB-aware
> implementation of this builder is used.
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com