users@jaxb.java.net

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

From: Kostis Anagnostopoulos <ankostis_at_gmail.com>
Date: Mon, 29 Jan 2007 13:29:14 +0200

Hi Aleksei,

On 1/29/07, Aleksei Valikov <valikov_at_gmx.net> wrote:
> Hi Kostis,
>
> > Would it be possible for you to help me upgrade the extendedCloneable
> > jaxbcommons plugin into xjc2?
>
> I have implemented the "copyable" plugin in jaxb2-commons/basic. It produces two
> copyTo methods:
>
> public Object copyTo(Object target, CopyBuilder copyBuilder)
> {
> ....
> }
>
> public Object copyTo(Object target)
> {
> final CopyBuilder copyBuilder = new JAXBCopyBuilder();
> return copyTo(target, copyBuilder);
> }
>

Thank you for the reply.
I now have the following questions:

1) I cannot find this plugin deployed in the maven2 java.net repo.
Do i have to check it out, build and deploy it in a private repo?


2) In order to use the plugin for cyclic documents, do i have to:

  a) implement my CopyBuilder which in its copy(Object) method does
ref accounting before invoking the super.copy(Object)

and also,
  b) ensure that all xjc generated classes implement the Cloneable
interface (how?)

Is that correct?

3) (assuming the above assumptions are correct)
In the old 'extendedCloneable' plugin, you didn't use ref-accounting
at all, but instead ensured that all xjc-generated classes implement a
specific interface that handles cycles appropriately.
You have pointed out that using ref accounting with ThreadLocal does
not constitute a solid solution.
Do you think that ref accounting *within* copyBuilder is a safe operation?

4) Also, i couldn't find any mention of this plugin on jaxb2-commons site.


Regards,
  Kostis