Use this type of MarshalRecord when the marshal target is a Writer and the JSON should not be formatted with carriage returns or indenting.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
JSONRecord jsonWriterRecord = new JSONWriterRecord();
jsonWriterRecord.setWriter(myWriter);
xmlMarshaller.marshal(myObject, jsonWriterRecord);
If the marshal(Writer) and setMediaType(MediaType.APPLICATION_JSON) and setFormattedOutput(false) method is called on XMLMarshaller, then the Writer is automatically wrapped in a JSONWriterRecord.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
xmlMarshaller.setMediaType(MediaType.APPLICATION_JSON);
xmlMarshaller xmlMarshaller.setFormattedOutput(false);
xmlMarshaller.marshal(myObject, myWriter);
org.eclipse.persistence.oxm.XMLMarshaller
| Modifier and Type | Class and Description |
|---|---|
| protected class | JSONWriterRecord.JSONWriterRecordContentHandler
This class will typically be used in conjunction with an XMLFragmentReader. |
| protected static class | JSONWriterRecord.Level
Instances of this class are used to maintain state about the current level of the JSON message being marshalled. |
| protected static interface | |
| protected static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| protected String | |
| protected String | |
| protected CharacterEscapeHandler | |
| protected boolean | |
| protected CharsetEncoder | |
| protected boolean | |
| protected JSONWriterRecord. | |
| protected static final String | |
| protected JSONWriterRecord. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | attribute(String
The namespace URI, if the attribute is not namespace
qualified the value of this parameter wil be null. namespaceURI, String The local name of the attribute. localName, String The qualified name of the attribute. qName, String This is the complete value for the attribute. value)Implements abstract org. Implements org. |
| public void | attribute(XPathFragment<XML_FIELD extends Field>
The XPathFragment contains the name and prefix
information about the XML element being ended. xPathFragment, NamespaceResolver The NamespaceResolver can be used to resolve the
namespace URI for the namespace prefix held by the XPathFragment (if
required). namespaceResolver, String This is the complete value for the attribute. value)Implements abstract org. Implements org. |
| public void | attribute(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver, Object value, QName schemaType)
Overrides org. Implements org. |
| public void | cdata(String
This is the value of the text to be wrapped value)Implements abstract org. Implements org. |
| public void | characters(String
This is the entire value of the text node. value)Implements abstract org. Implements org. |
| public void | |
| public void | characters(QName schemaType, Object value, String mimeType, boolean isCDATA)
Overrides org. Implements org. |
| public void | |
| protected void | |
| public void | closeStartElement()
Implements abstract org. Implements org. |
| public void | defaultNamespaceDeclaration(String defaultNamespace)
Overrides org. |
| public void | element(XPathFragment<XML_FIELD extends Field>
The XPathFragment of the element frag)Implements abstract org. |
| public void | emptyAttribute(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver)
Overrides org. Implements org. |
| public boolean | emptyCollection(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver, boolean
if grouping elements should be marshalled for empty collections openGrouping)Overrides org. Implements org. |
| public void | emptyComplex(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver)
Overrides org. Implements org. |
| public void | emptySimple(NamespaceResolver namespaceResolver)
Overrides org. Implements org. |
| protected void | |
| public void | endCollection()
Overrides org. Implements org. |
| public void | endDocument()
Implements abstract org. |
| public void | endElement(XPathFragment<XML_FIELD extends Field>
The XPathFragment contains the name and prefix
information about the XML element being ended. xPathFragment, NamespaceResolver The NamespaceResolver can be used to resolve the
namespace URI for the namespace prefix held by the XPathFragment (if
required). namespaceResolver)Implements abstract org. Implements org. |
| protected void | |
| public void | endPrefixMappings(NamespaceResolver namespaceResolver)
Overrides org. |
| public void | |
| public void | |
| public char | getNamespaceSeparator()
Overrides org. Implements org. |
| protected String | |
| public XPathFragment | getTextWrapperFragment()
Overrides org. Implements org. |
| public Writer | |
| private boolean | |
| public boolean | |
| public void | marshalWithoutRootElement(ObjectBuilder<ABSTRACT_RECORD extends CoreAbstractRecord, ABSTRACT_SESSION extends CoreAbstractSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform<CONVERSION_MANAGER extends CoreConversionManager>, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager<SESSION_EVENT_LISTENER extends CoreSessionEventListener>>, DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, MARSHALLER extends Marshaller<CHARACTER_ESCAPE_HANDLER extends CharacterEscapeHandler, CONTEXT extends Context<ABSTRACT_SESSION extends CoreAbstractSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform<CONVERSION_MANAGER extends CoreConversionManager>, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager<SESSION_EVENT_LISTENER extends CoreSessionEventListener>>, DESCRIPTOR extends Descriptor<?, ?, ?, ?, ?, NAMESPACE_RESOLVER, ?, ?, ?, ?>, FIELD extends Field, NAMESPACE_RESOLVER extends NamespaceResolver, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION extends CoreSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager>, SESSION_EVENT_LISTENER extends CoreSessionEventListener>, MARSHALLER_LISTENER extends Marshaller.
Overrides org. |
| public void | namespaceDeclaration(String prefix, String namespaceURI)
Overrides org. Implements org. |
| public void | namespaceDeclarations(NamespaceResolver
The NamespaceResolver contains the namespace
prefix and URI pairings that need to be declared. namespaceResolver)Overrides org. |
| public void | nilComplex(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver)
Overrides org. Implements org. |
| public void | nilSimple(NamespaceResolver namespaceResolver)
Overrides org. Implements org. |
| public void | node(Node
The Node to be added to the document node, NamespaceResolver The NamespaceResolver can be used to resolve the
namespace URI/prefix of the node namespaceResolver, String replacement root name for the node uri, String replacement root namespace for the node
namespace URI/prefix of the node name)Implements abstract org. |
| public void | openStartElement(XPathFragment<XML_FIELD extends Field>
The XPathFragment contains the name and prefix
information about the XML element being ended. xPathFragment, NamespaceResolver The NamespaceResolver can be used to resolve the
namespace URI for the namespace prefix held by the XPathFragment (if
required). namespaceResolver)Overrides org. Implements org. |
| public void | |
| public void | setMarshaller(XMLMarshaller<ABSTRACT_SESSION extends CoreAbstractSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform<CONVERSION_MANAGER extends CoreConversionManager>, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager<SESSION_EVENT_LISTENER extends CoreSessionEventListener>>, CHARACTER_ESCAPE_HANDLER extends CharacterEscapeHandler, CONTEXT extends Context<ABSTRACT_SESSION, DESCRIPTOR, ?, ?, ?, SESSION, ?>, DESCRIPTOR extends Descriptor<?, ?, ?, ?, ?, ?, ?, ?, ?, ?>, MARSHALLER_LISTENER extends Marshaller.
Overrides org. Implements org. |
| public void | |
| protected void | |
| public void | startCollection()
Overrides org. Implements org. |
| public void | startDocument(String
The XML document will be encoded using this encoding. encoding, String This specifies the version of XML. version)Implements abstract org. |
| public void | startPrefixMappings(NamespaceResolver namespaceResolver)
Overrides org. |
| protected void | |
| protected void | |
| protected void | |
| protected void |