Spring Web Services Framework

org.springframework.oxm.jaxb
Class Jaxb1Marshaller

java.lang.Object
  extended by org.springframework.oxm.jaxb.AbstractJaxbMarshaller
      extended by org.springframework.oxm.jaxb.Jaxb1Marshaller
All Implemented Interfaces:
BeanClassLoaderAware, InitializingBean, Marshaller, Unmarshaller

public class Jaxb1Marshaller
extends AbstractJaxbMarshaller
implements BeanClassLoaderAware

Implementation of the Marshaller interface for JAXB 1.0.

The typical usage will be to set the contextPath property on this bean, possibly customize the marshaller and unmarshaller by setting properties, and validations, and to refer to it.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
AbstractJaxbMarshaller.setContextPath(String), AbstractJaxbMarshaller.setMarshallerProperties(java.util.Map), AbstractJaxbMarshaller.setUnmarshallerProperties(java.util.Map), setValidating(boolean)

Field Summary
 
Fields inherited from class org.springframework.oxm.jaxb.AbstractJaxbMarshaller
logger
 
Constructor Summary
Jaxb1Marshaller()
           
 
Method Summary
protected  JAXBContext createJaxbContext()
          Template method that returns a newly created JAXB context.
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 setBeanClassLoader(ClassLoader classLoader)
           
 void setValidating(boolean validating)
          Set if the JAXB Unmarshaller should validate the incoming document.
 boolean supports(Class clazz)
          Indicates whether this marshaller can marshal instances of the supplied type.
 Object unmarshal(Source source)
          Unmarshals the given Source into an object graph.
 
Methods inherited from class org.springframework.oxm.jaxb.AbstractJaxbMarshaller
afterPropertiesSet, convertJaxbException, createMarshaller, createUnmarshaller, getContextPath, getJaxbContext, initJaxbMarshaller, 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

Jaxb1Marshaller

public Jaxb1Marshaller()
Method Detail

setBeanClassLoader

public void setBeanClassLoader(ClassLoader classLoader)
Specified by:
setBeanClassLoader in interface BeanClassLoaderAware

setValidating

public void setValidating(boolean validating)
Set if the JAXB Unmarshaller should validate the incoming document. Default is false.


supports

public boolean supports(Class clazz)
Description copied from interface: Marshaller
Indicates whether this marshaller can marshal instances of the supplied type.

Specified by:
supports in interface Marshaller
Specified by:
supports in interface Unmarshaller
Parameters:
clazz - the class that this marshaller is being asked if it can marshal
Returns:
true if this marshaller can indeed marshal instances of the supplied class; false otherwise

createJaxbContext

protected final JAXBContext createJaxbContext()
                                       throws JAXBException
Description copied from class: AbstractJaxbMarshaller
Template method that returns a newly created JAXB context. Called from afterPropertiesSet().

Specified by:
createJaxbContext in class AbstractJaxbMarshaller
Throws:
JAXBException

initJaxbUnmarshaller

protected void initJaxbUnmarshaller(Unmarshaller unmarshaller)
                             throws JAXBException
Description copied from class: AbstractJaxbMarshaller
Template method that can overridden by concrete JAXB marshallers for custom initialization behavior. Gets called after creation of JAXB Unmarshaller, and after the respective properties have been set.

Default implementation does nothing.

Overrides:
initJaxbUnmarshaller in class AbstractJaxbMarshaller
Throws:
JAXBException

marshal

public void marshal(Object graph,
                    Result result)
Description copied from interface: Marshaller
Marshals the object graph with the given root into the provided Result.

Specified by:
marshal in interface Marshaller
Parameters:
graph - the root of the object graph to marshal
result - the result to marshal to

unmarshal

public Object unmarshal(Source source)
Description copied from interface: Unmarshaller
Unmarshals the given Source into an object graph.

Specified by:
unmarshal in interface Unmarshaller
Parameters:
source - the source to marshal from
Returns:
the object graph

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.