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 of Marshaller interface for the JAXB RI.
Eventually all the marshal(java.lang.Object, java.io.OutputStream, javax.xml.namespace.NamespaceContext) methods call into
the write(com.sun.xml.bind.v2.runtime.Name, com.sun.xml.bind.v2.runtime.JaxBeanInfo, T, com.sun.xml.bind.v2.runtime.output.XmlOutput, java.lang.Runnable) method.
- Author:
- Kohsuke Kawaguchi, Vivek Pandey
|
Method Summary |
protected CharacterEscapeHandler |
createEscapeHandler(String encoding)
|
XmlOutput |
createWriter(OutputStream os)
|
XmlOutput |
createWriter(OutputStream os,
String encoding)
|
XmlOutput |
createWriter(Writer w)
|
XmlOutput |
createWriter(Writer w,
String encoding)
|
|
getAdapter(Class<A> type)
|
AttachmentMarshaller |
getAttachmentMarshaller()
|
JAXBContextImpl |
getContext()
|
Marshaller.Listener |
getListener()
|
Object |
getProperty(String name)
|
Schema |
getSchema()
|
boolean |
handleEvent(ValidationEvent event)
Default error handling behavior fot Marshaller. |
void |
marshal(Object obj,
OutputStream out,
NamespaceContext inscopeNamespace)
Marshals to OutputStream with the given in-scope namespaces
taken into account. |
void |
marshal(Object target,
Result result)
|
void |
marshal(Object obj,
XMLEventWriter writer)
|
void |
marshal(Object obj,
XmlOutput output)
|
void |
marshal(Object obj,
XMLStreamWriter writer)
|
|
setAdapter(Class<A> type,
A adapter)
|
void |
setAttachmentMarshaller(AttachmentMarshaller am)
|
void |
setListener(Marshaller.Listener listener)
|
void |
setProperty(String name,
Object value)
|
void |
setSchema(Schema s)
|
protected
|
write(Name rootTagName,
JaxBeanInfo<T> bi,
T obj,
XmlOutput out,
Runnable postInitAction)
Used by BridgeImpl to write an arbitrary object as a fragment. |
| 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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
MarshallerImpl
public MarshallerImpl(JAXBContextImpl c,
AssociationMap assoc)
- Parameters:
assoc - non-null if the marshaller is working inside BinderImpl.
getContext
public JAXBContextImpl getContext()
marshal
public void marshal(Object obj,
OutputStream out,
NamespaceContext inscopeNamespace)
throws JAXBException
- Marshals to
OutputStream 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 interface Marshaller- Overrides:
marshal in class AbstractMarshallerImpl
- Throws:
JAXBException
marshal
public void marshal(Object obj,
XMLEventWriter writer)
throws JAXBException
- Specified by:
marshal in interface Marshaller- Overrides:
marshal in class AbstractMarshallerImpl
- 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 interface Marshaller
- Throws:
JAXBException
write
protected final <T> void write(Name rootTagName,
JaxBeanInfo<T> bi,
T obj,
XmlOutput out,
Runnable postInitAction)
throws JAXBException
- Used by
BridgeImpl to write an arbitrary object as a fragment.
- Throws:
JAXBException
createEscapeHandler
protected CharacterEscapeHandler createEscapeHandler(String encoding)
createWriter
public XmlOutput createWriter(Writer w,
String encoding)
createWriter
public XmlOutput createWriter(Writer w)
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 interface Marshaller- Overrides:
getProperty in class AbstractMarshallerImpl
- Throws:
PropertyException
setProperty
public void setProperty(String name,
Object value)
throws PropertyException
- Specified by:
setProperty in interface Marshaller- Overrides:
setProperty in class AbstractMarshallerImpl
- Throws:
PropertyException
setAdapter
public <A extends XmlAdapter> void setAdapter(Class<A> type,
A adapter)
- Specified by:
setAdapter in interface Marshaller- Overrides:
setAdapter in class AbstractMarshallerImpl
getAdapter
public <A extends XmlAdapter> A getAdapter(Class<A> type)
- Specified by:
getAdapter in interface Marshaller- Overrides:
getAdapter in class AbstractMarshallerImpl
setAttachmentMarshaller
public void setAttachmentMarshaller(AttachmentMarshaller am)
- Specified by:
setAttachmentMarshaller in interface Marshaller- Overrides:
setAttachmentMarshaller in class AbstractMarshallerImpl
getAttachmentMarshaller
public AttachmentMarshaller getAttachmentMarshaller()
- Specified by:
getAttachmentMarshaller in interface Marshaller- Overrides:
getAttachmentMarshaller in class AbstractMarshallerImpl
getSchema
public Schema getSchema()
- Specified by:
getSchema in interface Marshaller- Overrides:
getSchema in class AbstractMarshallerImpl
setSchema
public void setSchema(Schema s)
- Specified by:
setSchema in interface Marshaller- Overrides:
setSchema in class AbstractMarshallerImpl
handleEvent
public boolean handleEvent(ValidationEvent event)
- Default error handling behavior fot
Marshaller.
- Specified by:
handleEvent in interface ValidationEventHandler
getListener
public Marshaller.Listener getListener()
- Specified by:
getListener in interface Marshaller- Overrides:
getListener in class AbstractMarshallerImpl
setListener
public void setListener(Marshaller.Listener listener)
- Specified by:
setListener in interface Marshaller- Overrides:
setListener in class AbstractMarshallerImpl
Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.