@Override public void setMarshaller(Marshaller marshaller) { super.setMarshaller(marshaller); validatingRecord.setMarshaller(marshaller); marshalRecord.setMarshaller(marshaller); }
@Override public void setMarshaller(Marshaller marshaller) { super.setMarshaller(marshaller); validatingRecord.setMarshaller(marshaller); marshalRecord.setMarshaller(marshaller); }
/** * INTERNAL: * This method is no longer required as now MarshalRecord maintains a * reference to the XMLMarshaller. * @param xPathFragment * @param marshalRecord * @param object * @param session * @param namespaceResolver * @param marshaller * @return */ public boolean marshal(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, AbstractSession session, NamespaceResolver namespaceResolver, org.eclipse.persistence.oxm.XMLMarshaller marshaller) { marshalRecord.setMarshaller(marshaller); return this.marshal(xPathFragment, marshalRecord, object, session, namespaceResolver); }
@Override public void setMarshaller(XMLMarshaller marshaller) { super.setMarshaller(marshaller); if (charset == marshaller.getEncoding()) { encoder.reset(); } else { encoder = Charset.forName(marshaller.getEncoding()).newEncoder(); charset = marshaller.getEncoding(); } }
@Override public void setMarshaller(XMLMarshaller marshaller) { super.setMarshaller(marshaller); if (charset == marshaller.getEncoding()) { encoder.reset(); } else { encoder = Charset.forName(marshaller.getEncoding()).newEncoder(); charset = marshaller.getEncoding(); } }
public void marshal(Object object, MarshalRecord record) throws JAXBException { if (object == null || record == null) { throw new IllegalArgumentException(); } object = validateAndTransformIfNeeded(object); // xml bindings + object try { record.setMarshaller(xmlMarshaller); xmlMarshaller.marshal(object, record); } catch (BeanValidationException bve) { throw new MarshalException(bve.getMessage(), String.valueOf(bve.getErrorCode()), bve); } catch (Exception e) { throw new MarshalException(e); } }
public void marshal(Object object, MarshalRecord record) throws JAXBException { if (object == null || record == null) { throw new IllegalArgumentException(); } object = validateAndTransformIfNeeded(object); // xml bindings + object try { record.setMarshaller(xmlMarshaller); xmlMarshaller.marshal(object, record); } catch (BeanValidationException bve) { throw new MarshalException(bve.getMessage(), String.valueOf(bve.getErrorCode()), bve); } catch (Exception e) { throw new MarshalException(e); } }
/** * INTERNAL: * Convert the given object to an XML Document * @param object the object to marshal * @return the document which the specified object has been marshalled to * @param descriptor the XMLDescriptor for the object being marshalled * @throws XMLMarshalException if an error occurred during marshalling */ protected Document objectToXML(Object object, DESCRIPTOR descriptor, boolean isXMLRoot) throws XMLMarshalException { ABSTRACT_SESSION session = context.getSession(descriptor); MarshalRecord marshalRecord = new NodeRecord(); marshalRecord.setMarshaller(this); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument(); }
protected Node objectToXMLNode(Object object, Node rootNode, ABSTRACT_SESSION session, DESCRIPTOR descriptor, boolean isXMLRoot) throws XMLMarshalException { MarshalRecord marshalRecord = new NodeRecord(); marshalRecord.setMarshaller(this); marshalRecord.getNamespaceResolver().setDOM(rootNode); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument(); }
/** * INTERNAL: * Convert the given object to an XML Document * @param object the object to marshal * @return the document which the specified object has been marshalled to * @param descriptor the XMLDescriptor for the object being marshalled * @throws XMLMarshalException if an error occurred during marshalling */ protected Document objectToXML(Object object, DESCRIPTOR descriptor, boolean isXMLRoot) throws XMLMarshalException { ABSTRACT_SESSION session = context.getSession(descriptor); MarshalRecord marshalRecord = new NodeRecord(); marshalRecord.setMarshaller(this); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument(); }
protected Node objectToXMLNode(Object object, Node rootNode, ABSTRACT_SESSION session, DESCRIPTOR descriptor, boolean isXMLRoot) throws XMLMarshalException { MarshalRecord marshalRecord = new NodeRecord(); marshalRecord.setMarshaller(this); marshalRecord.getNamespaceResolver().setDOM(rootNode); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument(); }
/** * INTERNAL: */ public void setMarshaller(XMLMarshaller marshaller) { super.setMarshaller(marshaller); attributePrefix = marshaller.getAttributePrefix(); encoder = Charset.forName(marshaller.getEncoding()).newEncoder(); if (marshaller.getValueWrapper() != null) { textWrapperFragment = new XPathFragment(); textWrapperFragment.setLocalName(marshaller.getValueWrapper()); } characterEscapeHandler = marshaller.getCharacterEscapeHandler(); writer.setMarshaller(marshaller); }
/** * INTERNAL: */ public void setMarshaller(XMLMarshaller marshaller) { super.setMarshaller(marshaller); attributePrefix = marshaller.getAttributePrefix(); encoder = Charset.forName(marshaller.getEncoding()).newEncoder(); if (marshaller.getValueWrapper() != null) { textWrapperFragment = new XPathFragment(); textWrapperFragment.setLocalName(marshaller.getValueWrapper()); } characterEscapeHandler = marshaller.getCharacterEscapeHandler(); writer.setMarshaller(marshaller); }
/** * INTERNAL: */ public void setMarshaller(XMLMarshaller marshaller) { super.setMarshaller(marshaller); attributePrefix = marshaller.getAttributePrefix(); if (marshaller.getValueWrapper() != null) { textWrapperFragment = new XPathFragment(); textWrapperFragment.setLocalName(marshaller.getValueWrapper()); } characterEscapeHandler = marshaller.getCharacterEscapeHandler(); }
/** * INTERNAL: */ public void setMarshaller(XMLMarshaller marshaller) { super.setMarshaller(marshaller); attributePrefix = marshaller.getAttributePrefix(); if (marshaller.getValueWrapper() != null) { textWrapperFragment = new XPathFragment(); textWrapperFragment.setLocalName(marshaller.getValueWrapper()); } characterEscapeHandler = marshaller.getCharacterEscapeHandler(); }
protected Node objectToXMLNode(Object object, Node rootNode, AbstractSession session,XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException { DocumentPreservationPolicy docPresPolicy = xmlContext.getDocumentPreservationPolicy(session); if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) { XMLRecord xmlRow = null; if (!isXMLRoot) { xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecordFor(object, xmlContext.getDocumentPreservationPolicy(session)); xmlRow.setMarshaller(this); if (getAttachmentMarshaller() != null) { xmlRow.setXOPPackage(getAttachmentMarshaller().isXOPPackage()); } if (xmlRow.getDOM().getNodeType() == Node.ELEMENT_NODE) { addDescriptorNamespacesToXMLRecord(descriptor, xmlRow); } } Document doc = objectToXML(object, rootNode, descriptor, xmlRow, isXMLRoot, docPresPolicy); if ((xmlRow != null) && (xmlRow.getDOM().getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) { return xmlRow.getDOM(); } else { return doc; } } MarshalRecord marshalRecord = new NodeRecord(); marshalRecord.setMarshaller(this); marshalRecord.getNamespaceResolver().setDOM(rootNode); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument(); }
marshalRecord.setMarshaller(this); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument();
/** * INTERNAL: * Convert the given object to an XML Document * @param object the object to marshal * @return the document which the specified object has been marshalled to * @param descriptor the XMLDescriptor for the object being marshalled * @throws XMLMarshalException if an error occurred during marshalling */ protected Document objectToXML(Object object, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException { AbstractSession session = xmlContext.getSession(descriptor); DocumentPreservationPolicy docPresPolicy = xmlContext.getDocumentPreservationPolicy(session); if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) { XMLRecord xmlRow = null; if (!isXMLRoot) { xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecordFor(object, xmlContext.getDocumentPreservationPolicy(session)); xmlRow.setMarshaller(this); if (getAttachmentMarshaller() != null) { xmlRow.setXOPPackage(getAttachmentMarshaller().isXOPPackage()); } addDescriptorNamespacesToXMLRecord(descriptor, xmlRow); } return objectToXML(object, descriptor, xmlRow, isXMLRoot, docPresPolicy); } MarshalRecord marshalRecord = new NodeRecord(); marshalRecord.setMarshaller(this); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument(); }
marshalRecord.setMarshaller(this); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument();
marshalRecord.setMarshaller(this); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument();