com.sun.xml.bind.v2.runtime

Class MarshallerImpl

public final class MarshallerImpl extends AbstractMarshallerImpl implements ValidationEventHandler

Implementation of Marshaller interface for the JAXB RI.

Eventually all the MarshallerImpl methods call into the MarshallerImpl method.

Field Summary
JAXBContextImplcontext
reference to the context that created this object
protected static StringC14N
protected static StringENCODING_HANDLER
protected static StringENCODING_HANDLER2
protected static StringINDENT_STRING
protected static StringOBJECT_IDENTITY_CYCLE_DETECTION
protected static StringPREFIX_MAPPER
protected XMLSerializerserializer
protected static StringXMLDECLARATION
protected static StringXML_HEADERS
Constructor Summary
MarshallerImpl(JAXBContextImpl c, AssociationMap assoc)
Method Summary
protected CharacterEscapeHandlercreateEscapeHandler(String encoding)
RunnablecreatePostInitAction(Result result)
Creates an appropriate post-init action object.
XmlOutputcreateWriter(Writer w, String encoding)
XmlOutputcreateWriter(Writer w)
XmlOutputcreateWriter(OutputStream os)
XmlOutputcreateWriter(OutputStream os, String encoding)
XmlOutputcreateXmlOutput(Result result)
Creates XmlOutput from the given Result object.
<A extends XmlAdapter> AgetAdapter(Class<A> type)
AttachmentMarshallergetAttachmentMarshaller()
JAXBContextImplgetContext()
ListenergetListener()
ObjectgetProperty(String name)
SchemagetSchema()
booleanhandleEvent(ValidationEvent event)
Default error handling behavior fot Marshaller.
voidmarshal(Object obj, OutputStream out, NamespaceContext inscopeNamespace)
Marshals to OutputStream with the given in-scope namespaces taken into account.
voidmarshal(Object obj, XMLStreamWriter writer)
voidmarshal(Object obj, XMLEventWriter writer)
voidmarshal(Object obj, XmlOutput output)
voidmarshal(Object target, Result result)
<A extends XmlAdapter> voidsetAdapter(Class<A> type, A adapter)
voidsetAttachmentMarshaller(AttachmentMarshaller am)
voidsetListener(Listener listener)
voidsetProperty(String name, Object value)
voidsetSchema(Schema s)
protected <T> voidwrite(Name rootTagName, JaxBeanInfo<T> bi, T obj, XmlOutput out, Runnable postInitAction)
Used by BridgeImpl to write an arbitrary object as a fragment.

Field Detail

context

final JAXBContextImpl context
reference to the context that created this object

C14N

protected static final String C14N

ENCODING_HANDLER

protected static final String ENCODING_HANDLER

ENCODING_HANDLER2

protected static final String ENCODING_HANDLER2

INDENT_STRING

protected static final String INDENT_STRING

OBJECT_IDENTITY_CYCLE_DETECTION

protected static final String OBJECT_IDENTITY_CYCLE_DETECTION

PREFIX_MAPPER

protected static final String PREFIX_MAPPER

serializer

protected final XMLSerializer serializer

XMLDECLARATION

protected static final String XMLDECLARATION

XML_HEADERS

protected static final String XML_HEADERS

Constructor Detail

MarshallerImpl

public MarshallerImpl(JAXBContextImpl c, AssociationMap assoc)

Parameters: assoc non-null if the marshaller is working inside BinderImpl.

Method Detail

createEscapeHandler

protected CharacterEscapeHandler createEscapeHandler(String encoding)

createPostInitAction

final Runnable createPostInitAction(Result result)
Creates an appropriate post-init action object.

createWriter

public XmlOutput createWriter(Writer w, String encoding)

createWriter

public XmlOutput createWriter(Writer w)

createWriter

public XmlOutput createWriter(OutputStream os)

createWriter

public XmlOutput createWriter(OutputStream os, String encoding)

createXmlOutput

final XmlOutput createXmlOutput(Result result)
Creates XmlOutput from the given Result object.

getAdapter

<A extends XmlAdapter> A getAdapter(Class<A> type)

getAttachmentMarshaller

AttachmentMarshaller getAttachmentMarshaller()

getContext

public JAXBContextImpl getContext()

getListener

Listener getListener()

getProperty

Object getProperty(String name)

getSchema

Schema getSchema()

handleEvent

public boolean handleEvent(ValidationEvent event)
Default error handling behavior fot Marshaller.

marshal

public void marshal(Object obj, OutputStream out, NamespaceContext inscopeNamespace)
Marshals to OutputStream with the given in-scope namespaces taken into account.

Since: 2.1.5

marshal

void marshal(Object obj, XMLStreamWriter writer)

marshal

void marshal(Object obj, XMLEventWriter writer)

marshal

public void marshal(Object obj, XmlOutput output)

marshal

public void marshal(Object target, Result result)

setAdapter

<A extends XmlAdapter> void setAdapter(Class<A> type, A adapter)

setAttachmentMarshaller

void setAttachmentMarshaller(AttachmentMarshaller am)

setListener

void setListener(Listener listener)

setProperty

void setProperty(String name, Object value)

setSchema

void setSchema(Schema s)

write

protected final <T> void write(Name rootTagName, JaxBeanInfo<T> bi, T obj, XmlOutput out, Runnable postInitAction)
Used by BridgeImpl to write an arbitrary object as a fragment.