Package com.sun.xml.bind.v2.runtime
Class MarshallerImpl
- java.lang.Object
-
- javax.xml.bind.helpers.AbstractMarshallerImpl
-
- com.sun.xml.bind.v2.runtime.MarshallerImpl
-
- All Implemented Interfaces:
Marshaller
,ValidationEventHandler
public final class MarshallerImpl extends AbstractMarshallerImpl implements ValidationEventHandler
Implementation ofMarshaller
interface for the JAXB RI.Eventually all the
marshal(java.lang.Object, java.io.OutputStream, javax.xml.namespace.NamespaceContext)
methods call into thewrite(com.sun.xml.bind.v2.runtime.Name, com.sun.xml.bind.v2.runtime.JaxBeanInfo<T>, T, com.sun.xml.bind.v2.runtime.output.XmlOutput, java.lang.Runnable)
method.- Author:
- Kohsuke Kawaguchi, Vivek Pandey
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.xml.bind.Marshaller
Marshaller.Listener
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
C14N
protected static String
ENCODING_HANDLER
protected static String
ENCODING_HANDLER2
protected static String
INDENT_STRING
protected static String
OBJECT_IDENTITY_CYCLE_DETECTION
protected static String
PREFIX_MAPPER
protected XMLSerializer
serializer
protected static String
XML_HEADERS
protected static String
XMLDECLARATION
-
Fields inherited from interface javax.xml.bind.Marshaller
JAXB_ENCODING, JAXB_FORMATTED_OUTPUT, JAXB_FRAGMENT, JAXB_NO_NAMESPACE_SCHEMA_LOCATION, JAXB_SCHEMA_LOCATION
-
-
Constructor Summary
Constructors Constructor Description MarshallerImpl(JAXBContextImpl c, AssociationMap assoc)
-
Method Summary
-
Methods inherited from class javax.xml.bind.helpers.AbstractMarshallerImpl
getEncoding, getEventHandler, getJavaEncoding, getNode, getNoNSSchemaLocation, getSchemaLocation, isFormattedOutput, isFragment, marshal, marshal, marshal, marshal, marshal, setAdapter, setEncoding, setEventHandler, setFormattedOutput, setFragment, setNoNSSchemaLocation, setSchemaLocation
-
-
-
-
Field Detail
-
serializer
protected final XMLSerializer serializer
-
INDENT_STRING
protected static final String INDENT_STRING
- See Also:
- Constant Field Values
-
PREFIX_MAPPER
protected static final String PREFIX_MAPPER
- See Also:
- Constant Field Values
-
ENCODING_HANDLER
protected static final String ENCODING_HANDLER
- See Also:
- Constant Field Values
-
ENCODING_HANDLER2
protected static final String ENCODING_HANDLER2
- See Also:
- Constant Field Values
-
XMLDECLARATION
protected static final String XMLDECLARATION
- See Also:
- Constant Field Values
-
XML_HEADERS
protected static final String XML_HEADERS
- See Also:
- Constant Field Values
-
C14N
protected static final String C14N
- See Also:
- Constant Field Values
-
OBJECT_IDENTITY_CYCLE_DETECTION
protected static final String OBJECT_IDENTITY_CYCLE_DETECTION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MarshallerImpl
public MarshallerImpl(JAXBContextImpl c, AssociationMap assoc)
- Parameters:
assoc
- non-null if the marshaller is working insideBinderImpl
.
-
-
Method Detail
-
getContext
public JAXBContextImpl getContext()
-
marshal
public void marshal(Object obj, OutputStream out, NamespaceContext inscopeNamespace) throws JAXBException
Marshals toOutputStream
with the given in-scope namespaces taken into account.- Throws:
JAXBException
- Since:
- 2.1.5
-
marshal
public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException
- Specified by:
marshal
in interfaceMarshaller
- Overrides:
marshal
in classAbstractMarshallerImpl
- Throws:
JAXBException
-
marshal
public void marshal(Object obj, XMLEventWriter writer) throws JAXBException
- Specified by:
marshal
in interfaceMarshaller
- Overrides:
marshal
in classAbstractMarshallerImpl
- Throws:
JAXBException
-
marshal
public void marshal(Object obj, XmlOutput output) throws JAXBException
- Throws:
JAXBException
-
marshal
public void marshal(Object target, Result result) throws JAXBException
- Specified by:
marshal
in interfaceMarshaller
- Throws:
JAXBException
-
write
protected final <T> void write(Name rootTagName, JaxBeanInfo<T> bi, T obj, XmlOutput out, Runnable postInitAction) throws JAXBException
Used byBridgeImpl
to write an arbitrary object as a fragment.- Throws:
JAXBException
-
createEscapeHandler
protected CharacterEscapeHandler createEscapeHandler(String encoding)
-
createWriter
public XmlOutput createWriter(OutputStream os) throws JAXBException
- Throws:
JAXBException
-
createWriter
public XmlOutput createWriter(OutputStream os, String encoding) throws JAXBException
- Throws:
JAXBException
-
getProperty
public Object getProperty(String name) throws PropertyException
- Specified by:
getProperty
in interfaceMarshaller
- Overrides:
getProperty
in classAbstractMarshallerImpl
- Throws:
PropertyException
-
setProperty
public void setProperty(String name, Object value) throws PropertyException
- Specified by:
setProperty
in interfaceMarshaller
- Overrides:
setProperty
in classAbstractMarshallerImpl
- Throws:
PropertyException
-
setAdapter
public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter)
- Specified by:
setAdapter
in interfaceMarshaller
- Overrides:
setAdapter
in classAbstractMarshallerImpl
-
getAdapter
public <A extends XmlAdapter> A getAdapter(Class<A> type)
- Specified by:
getAdapter
in interfaceMarshaller
- Overrides:
getAdapter
in classAbstractMarshallerImpl
-
setAttachmentMarshaller
public void setAttachmentMarshaller(AttachmentMarshaller am)
- Specified by:
setAttachmentMarshaller
in interfaceMarshaller
- Overrides:
setAttachmentMarshaller
in classAbstractMarshallerImpl
-
getAttachmentMarshaller
public AttachmentMarshaller getAttachmentMarshaller()
- Specified by:
getAttachmentMarshaller
in interfaceMarshaller
- Overrides:
getAttachmentMarshaller
in classAbstractMarshallerImpl
-
getSchema
public Schema getSchema()
- Specified by:
getSchema
in interfaceMarshaller
- Overrides:
getSchema
in classAbstractMarshallerImpl
-
setSchema
public void setSchema(Schema s)
- Specified by:
setSchema
in interfaceMarshaller
- Overrides:
setSchema
in classAbstractMarshallerImpl
-
handleEvent
public boolean handleEvent(ValidationEvent event)
Default error handling behavior fotMarshaller
.- Specified by:
handleEvent
in interfaceValidationEventHandler
-
getListener
public Marshaller.Listener getListener()
- Specified by:
getListener
in interfaceMarshaller
- Overrides:
getListener
in classAbstractMarshallerImpl
-
setListener
public void setListener(Marshaller.Listener listener)
- Specified by:
setListener
in interfaceMarshaller
- Overrides:
setListener
in classAbstractMarshallerImpl
-
-