org.apache.camel.component.jackson
Class JacksonDataFormat

java.lang.Object
  extended by org.apache.camel.component.jackson.JacksonDataFormat
All Implemented Interfaces:
org.apache.camel.spi.DataFormat

public class JacksonDataFormat
extends Object
implements org.apache.camel.spi.DataFormat

A data format (DataFormat) using Jackson to marshal to and from JSON.


Constructor Summary
JacksonDataFormat()
          Use the default Jackson ObjectMapper and Map
JacksonDataFormat(Class<?> unmarshalType)
          Use the default Jackson ObjectMapper and with a custom unmarshal type
JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView)
          Use the default Jackson ObjectMapper and with a custom unmarshal type and JSON view
JacksonDataFormat(org.codehaus.jackson.map.ObjectMapper mapper, Class<?> unmarshalType)
          Use a custom Jackson mapper and and unmarshal type
JacksonDataFormat(org.codehaus.jackson.map.ObjectMapper mapper, Class<?> unmarshalType, Class<?> jsonView)
          Use a custom Jackson mapper, unmarshal type and JSON view
 
Method Summary
 Class<?> getJsonView()
           
 org.codehaus.jackson.map.ObjectMapper getObjectMapper()
           
 Class<?> getUnmarshalType()
           
 void marshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream)
           
 void setJsonView(Class<?> jsonView)
           
 void setUnmarshalType(Class<?> unmarshalType)
           
 Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JacksonDataFormat

public JacksonDataFormat()
Use the default Jackson ObjectMapper and Map


JacksonDataFormat

public JacksonDataFormat(Class<?> unmarshalType)
Use the default Jackson ObjectMapper and with a custom unmarshal type

Parameters:
unmarshalType - the custom unmarshal type

JacksonDataFormat

public JacksonDataFormat(Class<?> unmarshalType,
                         Class<?> jsonView)
Use the default Jackson ObjectMapper and with a custom unmarshal type and JSON view

Parameters:
unmarshalType - the custom unmarshal type
jsonView - marker class to specifiy properties to be included during marshalling. See also http://wiki.fasterxml.com/JacksonJsonViews

JacksonDataFormat

public JacksonDataFormat(org.codehaus.jackson.map.ObjectMapper mapper,
                         Class<?> unmarshalType)
Use a custom Jackson mapper and and unmarshal type

Parameters:
mapper - the custom mapper
unmarshalType - the custom unmarshal type

JacksonDataFormat

public JacksonDataFormat(org.codehaus.jackson.map.ObjectMapper mapper,
                         Class<?> unmarshalType,
                         Class<?> jsonView)
Use a custom Jackson mapper, unmarshal type and JSON view

Parameters:
mapper - the custom mapper
unmarshalType - the custom unmarshal type
jsonView - marker class to specifiy properties to be included during marshalling. See also http://wiki.fasterxml.com/JacksonJsonViews
Method Detail

marshal

public void marshal(org.apache.camel.Exchange exchange,
                    Object graph,
                    OutputStream stream)
             throws Exception
Specified by:
marshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

unmarshal

public Object unmarshal(org.apache.camel.Exchange exchange,
                        InputStream stream)
                 throws Exception
Specified by:
unmarshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

getUnmarshalType

public Class<?> getUnmarshalType()

setUnmarshalType

public void setUnmarshalType(Class<?> unmarshalType)

getJsonView

public Class<?> getJsonView()

setJsonView

public void setJsonView(Class<?> jsonView)

getObjectMapper

public org.codehaus.jackson.map.ObjectMapper getObjectMapper()


Apache CAMEL