/** * If an object is wrapped in a JAXBElement, return the object. * Warning: be careful with this. If you are copying objects * into your document (rather than just reading them), you'll * probably want the object to remain wrapped (JAXB usually wraps them * for a reason; without the wrapper, you'll (probably?) need an * @XmlRootElement annotation in order to be able to marshall ie save your * document). * * @param o * @return */ public static Object unwrap(Object o) { if (o==null) return null; if (o instanceof javax.xml.bind.JAXBElement) { log.debug("Unwrapped " + ((JAXBElement)o).getDeclaredType().getName() ); log.debug("name: " + ((JAXBElement)o).getName() ); return ((JAXBElement)o).getValue(); } else { return o; } /* * Interestingly, DocumentSettingsPart (settings.xml) gets unwrapped, * and CTSettings does not have @XmlRootElement, but this does * not cause a problem when it is marshalled. */ }
public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException { Class scope = e.getScope(); if(e.isGlobalScope()) scope = null; QName n = e.getName(); ElementBeanInfoImpl bi = grammar.getElement(scope,n); if(bi==null) { tbi = grammar.getBeanInfo(e.getDeclaredType(),true); } catch (JAXBException x) { return; Object value = e.getValue(); target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null); if(value==null) {
public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException { Class scope = e.getScope(); if(e.isGlobalScope()) scope = null; QName n = e.getName(); ElementBeanInfoImpl bi = grammar.getElement(scope,n); if(bi==null) { tbi = grammar.getBeanInfo(e.getDeclaredType(),true); } catch (JAXBException x) { return; Object value = e.getValue(); target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null); if(value==null) {
@Nullable public static <DATATYPE> JAXBElement <DATATYPE> getClonedJAXBElement (@Nullable final JAXBElement <DATATYPE> aObj) { if (aObj == null) return null; final DATATYPE aClonedValue = CloneHelper.getClonedValue (aObj.getValue ()); final JAXBElement <DATATYPE> ret = new JAXBElement <> (aObj.getName (), aObj.getDeclaredType (), aObj.getScope (), aClonedValue); ret.setNil (aObj.isNil ()); return ret; } }
/** * Creates and returns a deep copy of a given {@code javax.xml.bind.JAXBElement<java.lang.String>} instance. * * @param e * The instance to copy or {@code null}. * @return * A deep copy of {@code e} or {@code null} if {@code e} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement<String> copyOfStringElement(final JAXBElement<String> e) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (e!= null) { final JAXBElement<String> copy = new JAXBElement<>(e.getName(), e.getDeclaredType(), e.getScope(), e.getValue()); copy.setNil(e.isNil()); // CBuiltinLeafInfo: java.lang.String copy.setValue(((String) copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code javax.xml.bind.JAXBElement<java.lang.String>} instance. * * @param e * The instance to copy or {@code null}. * @return * A deep copy of {@code e} or {@code null} if {@code e} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement<String> copyOfStringElement(final JAXBElement<String> e) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (e!= null) { final JAXBElement<String> copy = new JAXBElement<String>(e.getName(), e.getDeclaredType(), e.getScope(), e.getValue()); copy.setNil(e.isNil()); // CBuiltinLeafInfo: java.lang.String copy.setValue(((String) copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
@SuppressWarnings({ "unchecked", "rawtypes" }) private JAXBElement<?> doDuplicateJAXBElement(JAXBElement<?> originalObject) { if (originalObject == null) return null; final JAXBElement<?> sourceElement = (JAXBElement<?>) originalObject; final Object sourceObject = sourceElement.getValue(); final Object copyObject = doDuplicate(sourceObject); final JAXBElement copyElement = new JAXBElement( sourceElement.getName(), sourceElement.getDeclaredType(), sourceElement.getScope(), copyObject); return copyElement; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code JAXBElement} instance. * * @param element * The instance to copy or {@code null}. * @return * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement copyOf(final JAXBElement element) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (element!= null) { final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); copy.setNil(element.isNil()); copy.setValue(copyOf(copy.getValue())); return copy; } return null; }
/** * Creates and returns a deep copy of a given {@code javax.xml.bind.JAXBElement<java.lang.Object>} instance. * * @param e * The instance to copy or {@code null}. * @return * A deep copy of {@code e} or {@code null} if {@code e} is {@code null}. */ @SuppressWarnings("unchecked") private static JAXBElement<Object> copyOfObjectElement(final JAXBElement<Object> e) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if (e!= null) { final JAXBElement<Object> copy = new JAXBElement<Object>(e.getName(), e.getDeclaredType(), e.getScope(), e.getValue()); copy.setNil(e.isNil()); // CBuiltinLeafInfo: java.lang.Object copy.setValue(copyOf(((Object) copy.getValue()))); return copy; } return null; }