/** * Updates the object associated with the provided node to reflect any changed made to that node. * If this Binder has no object associated with the given node, then no operation is performed. * @param node */ public void updateObject(org.w3c.dom.Node node) { if (node.getNodeType() == Node.DOCUMENT_NODE) { node = ((Document) node).getDocumentElement(); } Object cachedObject = documentPreservationPolicy.getObjectForNode(node); if (cachedObject != null) { unmarshal(node); } else { throw XMLMarshalException.objectNotFoundInCache(node.getNodeName()); } }
/** * Updates the object associated with the provided node to reflect any changed made to that node. * If this Binder has no object associated with the given node, then no operation is performed. * @param node */ public void updateObject(org.w3c.dom.Node node) { if (node.getNodeType() == Node.DOCUMENT_NODE) { node = ((Document) node).getDocumentElement(); } Object cachedObject = documentPreservationPolicy.getObjectForNode(node); if (cachedObject != null) { unmarshal(node); } else { throw XMLMarshalException.objectNotFoundInCache(node.getNodeName()); } }
/** * Updates the object associated with the provided node to reflect any changed made to that node. * If this Binder has no object associated with the given node, then no operation is performed. * @param node */ public void updateObject(org.w3c.dom.Node node) { if (node.getNodeType() == Node.DOCUMENT_NODE) { node = ((Document) node).getDocumentElement(); } Object cachedObject = documentPreservationPolicy.getObjectForNode(node); if (cachedObject != null) { unmarshal(node); } else { throw XMLMarshalException.objectNotFoundInCache(node.getNodeName()); } }
public JAXBElement unmarshal(Object obj, Class javaClass) throws JAXBException { if (null == obj || null == javaClass) { throw new IllegalArgumentException(); } try { Root xmlRoot = (Root) xmlBinder.unmarshal((Node) obj, javaClass); return new JAXBElement(new QName(xmlRoot.getNamespaceURI(), xmlRoot.getLocalName()), javaClass, xmlRoot.getObject()); } catch (Exception e) { throw new UnmarshalException(e); } }
@Override public JAXBElement unmarshal(Object obj, Class javaClass) throws JAXBException { if (null == obj || null == javaClass) { throw new IllegalArgumentException(); } try { Root xmlRoot = xmlBinder.unmarshal((Node) obj, javaClass); return new JAXBElement(new QName(xmlRoot.getNamespaceURI(), xmlRoot.getLocalName()), javaClass, xmlRoot.getObject()); } catch (Exception e) { throw new UnmarshalException(e); } }
public Object unmarshal(Object obj) throws JAXBException { if (null == obj) { throw new IllegalArgumentException(); } try { Object returnValue = xmlBinder.unmarshal((Node) obj); if (returnValue instanceof Root) { Root xmlRoot = (Root) returnValue; if(xmlRoot.getObject() instanceof JAXBElement) { return xmlRoot.getObject(); } return new JAXBElement(new QName(xmlRoot.getNamespaceURI(), xmlRoot.getLocalName()), xmlRoot.getObject().getClass(), xmlRoot.getObject()); } else { return returnValue; } } catch (Exception e) { throw new UnmarshalException(e); } }
@Override public Object unmarshal(Object obj) throws JAXBException { if (null == obj) { throw new IllegalArgumentException(); } try { Object returnValue = xmlBinder.unmarshal((Node) obj); if (returnValue instanceof Root) { Root xmlRoot = (Root) returnValue; if(xmlRoot.getObject() instanceof JAXBElement) { return xmlRoot.getObject(); } return new JAXBElement(new QName(xmlRoot.getNamespaceURI(), xmlRoot.getLocalName()), xmlRoot.getObject().getClass(), xmlRoot.getObject()); } else { return returnValue; } } catch (Exception e) { throw new UnmarshalException(e); } }