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:
- javax.xml.bind.Marshaller, javax.xml.bind.ValidationEventHandler
public final class MarshallerImpl
- extends javax.xml.bind.helpers.AbstractMarshallerImpl
- implements javax.xml.bind.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
| Fields inherited from interface javax.xml.bind.Marshaller |
JAXB_ENCODING, JAXB_FORMATTED_OUTPUT, JAXB_FRAGMENT, JAXB_NO_NAMESPACE_SCHEMA_LOCATION, JAXB_SCHEMA_LOCATION |
|
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)
|
javax.xml.bind.attachment.AttachmentMarshaller |
getAttachmentMarshaller()
|
JAXBContextImpl |
getContext()
|
javax.xml.bind.Marshaller.Listener |
getListener()
|
Object |
getProperty(String name)
|
Schema |
getSchema()
|
boolean |
handleEvent(javax.xml.bind.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,
javax.xml.stream.XMLEventWriter writer)
|
void |
marshal(Object obj,
XmlOutput output)
|
void |
marshal(Object obj,
javax.xml.stream.XMLStreamWriter writer)
|
|
setAdapter(Class<A> type,
A adapter)
|
void |
setAttachmentMarshaller(javax.xml.bind.attachment.AttachmentMarshaller am)
|
void |
setListener(javax.xml.bind.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 javax.xml.bind.JAXBException
- Marshals to
OutputStream with the given in-scope namespaces
taken into account.
- Throws:
javax.xml.bind.JAXBException- Since:
- 2.1.5
marshal
public void marshal(Object obj,
javax.xml.stream.XMLStreamWriter writer)
throws javax.xml.bind.JAXBException
- Specified by:
marshal in interface javax.xml.bind.Marshaller- Overrides:
marshal in class javax.xml.bind.helpers.AbstractMarshallerImpl
- Throws:
javax.xml.bind.JAXBException
marshal
public void marshal(Object obj,
javax.xml.stream.XMLEventWriter writer)
throws javax.xml.bind.JAXBException
- Specified by:
marshal in interface javax.xml.bind.Marshaller- Overrides:
marshal in class javax.xml.bind.helpers.AbstractMarshallerImpl
- Throws:
javax.xml.bind.JAXBException
marshal
public void marshal(Object obj,
XmlOutput output)
throws javax.xml.bind.JAXBException
- Throws:
javax.xml.bind.JAXBException
marshal
public void marshal(Object target,
Result result)
throws javax.xml.bind.JAXBException
- Specified by:
marshal in interface javax.xml.bind.Marshaller
- Throws:
javax.xml.bind.JAXBException
write
protected final <T> void write(Name rootTagName,
JaxBeanInfo<T> bi,
T obj,
XmlOutput out,
Runnable postInitAction)
throws javax.xml.bind.JAXBException
- Used by
BridgeImpl to write an arbitrary object as a fragment.
- Throws:
javax.xml.bind.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 javax.xml.bind.JAXBException
- Throws:
javax.xml.bind.JAXBException
createWriter
public XmlOutput createWriter(OutputStream os,
String encoding)
throws javax.xml.bind.JAXBException
- Throws:
javax.xml.bind.JAXBException
getProperty
public Object getProperty(String name)
throws javax.xml.bind.PropertyException
- Specified by:
getProperty in interface javax.xml.bind.Marshaller- Overrides:
getProperty in class javax.xml.bind.helpers.AbstractMarshallerImpl
- Throws:
javax.xml.bind.PropertyException
setProperty
public void setProperty(String name,
Object value)
throws javax.xml.bind.PropertyException
- Specified by:
setProperty in interface javax.xml.bind.Marshaller- Overrides:
setProperty in class javax.xml.bind.helpers.AbstractMarshallerImpl
- Throws:
javax.xml.bind.PropertyException
setAdapter
public <A extends javax.xml.bind.annotation.adapters.XmlAdapter> void setAdapter(Class<A> type,
A adapter)
- Specified by:
setAdapter in interface javax.xml.bind.Marshaller- Overrides:
setAdapter in class javax.xml.bind.helpers.AbstractMarshallerImpl
getAdapter
public <A extends javax.xml.bind.annotation.adapters.XmlAdapter> A getAdapter(Class<A> type)
- Specified by:
getAdapter in interface javax.xml.bind.Marshaller- Overrides:
getAdapter in class javax.xml.bind.helpers.AbstractMarshallerImpl
setAttachmentMarshaller
public void setAttachmentMarshaller(javax.xml.bind.attachment.AttachmentMarshaller am)
- Specified by:
setAttachmentMarshaller in interface javax.xml.bind.Marshaller- Overrides:
setAttachmentMarshaller in class javax.xml.bind.helpers.AbstractMarshallerImpl
getAttachmentMarshaller
public javax.xml.bind.attachment.AttachmentMarshaller getAttachmentMarshaller()
- Specified by:
getAttachmentMarshaller in interface javax.xml.bind.Marshaller- Overrides:
getAttachmentMarshaller in class javax.xml.bind.helpers.AbstractMarshallerImpl
getSchema
public Schema getSchema()
- Specified by:
getSchema in interface javax.xml.bind.Marshaller- Overrides:
getSchema in class javax.xml.bind.helpers.AbstractMarshallerImpl
setSchema
public void setSchema(Schema s)
- Specified by:
setSchema in interface javax.xml.bind.Marshaller- Overrides:
setSchema in class javax.xml.bind.helpers.AbstractMarshallerImpl
handleEvent
public boolean handleEvent(javax.xml.bind.ValidationEvent event)
- Default error handling behavior fot
Marshaller.
- Specified by:
handleEvent in interface javax.xml.bind.ValidationEventHandler
getListener
public javax.xml.bind.Marshaller.Listener getListener()
- Specified by:
getListener in interface javax.xml.bind.Marshaller- Overrides:
getListener in class javax.xml.bind.helpers.AbstractMarshallerImpl
setListener
public void setListener(javax.xml.bind.Marshaller.Listener listener)
- Specified by:
setListener in interface javax.xml.bind.Marshaller- Overrides:
setListener in class javax.xml.bind.helpers.AbstractMarshallerImpl
Copyright © 2005-2012 Oracle Corporation. All Rights Reserved.