users@jaxb.java.net

cloning JAXBElements

From: Alec Swan <aukcioner_at_yahoo.com>
Date: Sun, 4 Jun 2006 16:40:42 -0700 (PDT)

I need to create a "deep" copy of a JAXBElement which was constructed by JAXB during the unmarshalling process. None of the classes generated by JAXB implement clone() method from java.lang.Object. The ObjectFactory class generated by JAXB didn't provide any API useful for this purpose either.

However, I noticed that JAXBElement implements Serializable and I could potentially use this to implement object cloning by serializing and de-serializing the target JAXBElement instance.

What is the right way to clone a JAXBElement instance?

Thanks.

Alec