|
Spring Web Services Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.oxm.jaxb.AbstractJaxbMarshaller org.springframework.oxm.jaxb.Jaxb2Marshaller
public class Jaxb2Marshaller
Implementation of the Marshaller
interface for JAXB 2.0.
contextPath
or the classesToBeBound
property on
this bean, possibly customize the marshaller and unmarshaller by setting properties, schemas, adapters, and
listeners, and to refer to it.
AbstractJaxbMarshaller.setContextPath(String)
,
setClassesToBeBound(Class[])
,
setJaxbContextProperties(java.util.Map)
,
AbstractJaxbMarshaller.setMarshallerProperties(java.util.Map)
,
AbstractJaxbMarshaller.setUnmarshallerProperties(java.util.Map)
,
setSchema(org.springframework.core.io.Resource)
,
setSchemas(org.springframework.core.io.Resource[])
,
setMarshallerListener(javax.xml.bind.Marshaller.Listener)
,
setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener)
,
setAdapters(javax.xml.bind.annotation.adapters.XmlAdapter[])
Field Summary |
---|
Fields inherited from class org.springframework.oxm.jaxb.AbstractJaxbMarshaller |
---|
logger |
Constructor Summary | |
---|---|
Jaxb2Marshaller()
|
Method Summary | |
---|---|
protected JAXBContext |
createJaxbContext()
Template method that returns a newly created JAXB context. |
protected void |
initJaxbMarshaller(Marshaller marshaller)
Template method that can be overridden by concrete JAXB marshallers for custom initialization behavior. |
protected void |
initJaxbUnmarshaller(Unmarshaller unmarshaller)
Template method that can overridden by concrete JAXB marshallers for custom initialization behavior. |
void |
marshal(Object graph,
Result result)
Marshals the object graph with the given root into the provided Result . |
void |
marshal(Object graph,
Result result,
MimeContainer mimeContainer)
Marshals the object graph with the given root into the provided Result , writing binary data to a MimeContainer . |
void |
setAdapters(XmlAdapter[] adapters)
Sets the XmlAdapter s to be registered with the JAXB Marshaller and
Unmarshaller |
void |
setBeanClassLoader(ClassLoader classLoader)
|
void |
setClassesToBeBound(Class[] classesToBeBound)
Sets the list of java classes to be recognized by a newly created JAXBContext. |
void |
setJaxbContextProperties(Map<String,?> jaxbContextProperties)
Sets the JAXBContext properties. |
void |
setMarshallerListener(Marshaller.Listener marshallerListener)
Sets the Marshaller.Listener to be registered with the JAXB Marshaller . |
void |
setMtomEnabled(boolean mtomEnabled)
Indicates whether MTOM support should be enabled or not. |
void |
setSchema(Resource schemaResource)
Sets the schema resource to use for validation. |
void |
setSchemaLanguage(String schemaLanguage)
Sets the schema language. |
void |
setSchemas(Resource[] schemaResources)
Sets the schema resources to use for validation. |
void |
setUnmarshallerListener(Unmarshaller.Listener unmarshallerListener)
Sets the Unmarshaller.Listener to be registered with the JAXB Unmarshaller . |
boolean |
supports(Class clazz)
Indicates whether this marshaller can marshal instances of the supplied type. |
boolean |
supports(Type type)
Indicates whether this marshaller can marshal instances of the supplied type. |
Object |
unmarshal(Source source)
Unmarshals the given Source into an object graph. |
Object |
unmarshal(Source source,
MimeContainer mimeContainer)
Unmarshals the given provided Source into an object graph, reading binary attachments from a MimeContainer . |
Methods inherited from class org.springframework.oxm.jaxb.AbstractJaxbMarshaller |
---|
afterPropertiesSet, convertJaxbException, createMarshaller, createUnmarshaller, getContextPath, getJaxbContext, setContextPath, setContextPaths, setMarshallerProperties, setUnmarshallerProperties, setValidationEventHandler |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Jaxb2Marshaller()
Method Detail |
---|
public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public void setAdapters(XmlAdapter[] adapters)
XmlAdapter
s to be registered with the JAXB Marshaller
and
Unmarshaller
public void setClassesToBeBound(Class[] classesToBeBound)
contextPath
is required.
AbstractJaxbMarshaller.setContextPath(String)
public void setJaxbContextProperties(Map<String,?> jaxbContextProperties)
JAXBContext
properties. These implementation-specific properties will be set on the
JAXBContext
.
public void setMarshallerListener(Marshaller.Listener marshallerListener)
Marshaller.Listener
to be registered with the JAXB Marshaller
.
public void setMtomEnabled(boolean mtomEnabled)
false
, marshalling using
XOP/MTOM is not enabled.
public void setSchemaLanguage(String schemaLanguage)
http://www.w3.org/2001/XMLSchema"
.
XMLConstants.W3C_XML_SCHEMA_NS_URI
,
XMLConstants.RELAXNG_NS_URI
public void setSchema(Resource schemaResource)
public void setSchemas(Resource[] schemaResources)
public void setUnmarshallerListener(Unmarshaller.Listener unmarshallerListener)
Unmarshaller.Listener
to be registered with the JAXB Unmarshaller
.
public boolean supports(Type type)
GenericMarshaller
supports
in interface GenericMarshaller
supports
in interface GenericUnmarshaller
type
- the type that this marshaller is being asked if it can marshal
true
if this marshaller can indeed marshal instances of the supplied type;
false
otherwisepublic boolean supports(Class clazz)
Marshaller
supports
in interface Marshaller
supports
in interface Unmarshaller
clazz
- the class that this marshaller is being asked if it can marshal
true
if this marshaller can indeed marshal instances of the supplied class;
false
otherwiseprotected JAXBContext createJaxbContext() throws Exception
AbstractJaxbMarshaller
afterPropertiesSet()
.
createJaxbContext
in class AbstractJaxbMarshaller
Exception
protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException
AbstractJaxbMarshaller
Marshaller
, and after the respective properties have been set.
Default implementation does nothing.
initJaxbMarshaller
in class AbstractJaxbMarshaller
JAXBException
protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException
AbstractJaxbMarshaller
Unmarshaller
, and after the respective properties have been set.
Default implementation does nothing.
initJaxbUnmarshaller
in class AbstractJaxbMarshaller
JAXBException
public void marshal(Object graph, Result result) throws XmlMappingException
Marshaller
Result
.
marshal
in interface Marshaller
graph
- the root of the object graph to marshalresult
- the result to marshal to
XmlMappingException
- if the given object cannot be marshalled to the resultpublic void marshal(Object graph, Result result, MimeContainer mimeContainer) throws XmlMappingException
MimeMarshaller
Result
, writing binary data to a MimeContainer
.
marshal
in interface MimeMarshaller
graph
- the root of the object graph to marshalresult
- the result to marshal tomimeContainer
- the MIME container to write extracted binary content to
XmlMappingException
- if the given object cannot be marshalled to the resultpublic Object unmarshal(Source source) throws XmlMappingException
Unmarshaller
Source
into an object graph.
unmarshal
in interface Unmarshaller
source
- the source to marshal from
XmlMappingException
- if the given source cannot be mapped to an objectpublic Object unmarshal(Source source, MimeContainer mimeContainer) throws XmlMappingException
MimeUnmarshaller
Source
into an object graph, reading binary attachments from a MimeContainer
.
unmarshal
in interface MimeUnmarshaller
source
- the source to marshal frommimeContainer
- the MIME container to read extracted binary content from
XmlMappingException
- if the given source cannot be mapped to an object
|
Spring Web Services Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |