private Catalogo copy ( Catalogo catalogo ) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; dbf . setNamespaceAware ( true ) ; DocumentBuilder db = dbf . newDocumentBuilder ( ) ; Document doc = db . newDocument ( ) ; Marshaller m = context . createMarshaller ( ) ; m . marshal ( catalogo , doc ) ; Unmarshaller u = context . createUnmarshaller ( ) ; return ( Catalogo ) u . unmarshal ( doc ) ; }
Defensive deep - copy