public class JacksonXMLDataFormat
extends org.apache.camel.support.ServiceSupport
implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName, org.apache.camel.CamelContextAware
Constructor and Description |
---|
JacksonXMLDataFormat()
Use the default Jackson
XmlMapper and Map |
JacksonXMLDataFormat(Class<?> unmarshalType)
Use the default Jackson
XmlMapper and with a custom unmarshal
type |
JacksonXMLDataFormat(Class<?> unmarshalType,
Class<?> jsonView)
Use the default Jackson
XmlMapper and with a custom unmarshal
type and JSON view |
JacksonXMLDataFormat(Class<?> unmarshalType,
Class<?> jsonView,
boolean enableJaxbAnnotationModule)
Use the default Jackson
XmlMapper and with a custom unmarshal
type and JSON view |
JacksonXMLDataFormat(com.fasterxml.jackson.dataformat.xml.XmlMapper mapper,
Class<?> unmarshalType)
Use a custom Jackson mapper and and unmarshal type
|
JacksonXMLDataFormat(com.fasterxml.jackson.dataformat.xml.XmlMapper mapper,
Class<?> unmarshalType,
Class<?> jsonView)
Use a custom Jackson mapper, unmarshal type and JSON view
|
Modifier and Type | Method and Description |
---|---|
void |
addModule(com.fasterxml.jackson.databind.Module module)
To use the custom Jackson module
|
void |
disableFeature(com.fasterxml.jackson.databind.DeserializationFeature feature) |
void |
disableFeature(com.fasterxml.jackson.databind.MapperFeature feature) |
void |
disableFeature(com.fasterxml.jackson.databind.SerializationFeature feature) |
protected void |
doStart() |
protected void |
doStop() |
void |
enableFeature(com.fasterxml.jackson.databind.DeserializationFeature feature) |
void |
enableFeature(com.fasterxml.jackson.databind.MapperFeature feature) |
void |
enableFeature(com.fasterxml.jackson.databind.SerializationFeature feature) |
org.apache.camel.CamelContext |
getCamelContext() |
Class<? extends Collection> |
getCollectionType() |
String |
getDataFormatName() |
String |
getDisableFeatures() |
String |
getEnableFeatures() |
String |
getInclude() |
Class<?> |
getJsonView() |
String |
getModuleClassNames() |
String |
getModuleRefs() |
List<com.fasterxml.jackson.databind.Module> |
getModules() |
TimeZone |
getTimezone() |
Class<?> |
getUnmarshalType() |
com.fasterxml.jackson.dataformat.xml.XmlMapper |
getXmlMapper() |
boolean |
isAllowJmsType() |
boolean |
isAllowUnmarshallType() |
boolean |
isContentTypeHeader() |
boolean |
isEnableJacksonTypeConverter() |
boolean |
isEnableJaxbAnnotationModule() |
boolean |
isPrettyPrint() |
boolean |
isUseList() |
void |
marshal(org.apache.camel.Exchange exchange,
Object graph,
OutputStream stream) |
void |
setAllowJmsType(boolean allowJmsType)
Allows jackson to use the JMSType header as an indicator what
the classname is for unmarshaling XML content to POJO
By default this option is false.
|
void |
setAllowUnmarshallType(boolean allowJacksonUnmarshallType)
If enabled then Jackson is allowed to attempt to use the
CamelJacksonUnmarshalType header during the unmarshalling.
|
void |
setCamelContext(org.apache.camel.CamelContext camelContext) |
void |
setCollectionType(Class<? extends Collection> collectionType) |
void |
setContentTypeHeader(boolean contentTypeHeader)
If enabled then Jackson will set the Content-Type header to
application/xml when marshalling.
|
void |
setDisableFeatures(String disableFeatures)
Set of features to disable on the Jackson
XmlMapper . |
void |
setEnableFeatures(String enableFeatures)
Set of features to enable on the Jackson
XmlMapper . |
void |
setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter)
If enabled then Jackson is allowed to attempt to be used during Camels
type converter
as a
FallbackConverter that attempts to convert
POJOs to/from Map /List types. |
void |
setEnableJaxbAnnotationModule(boolean enableJaxbAnnotationModule) |
void |
setInclude(String include) |
void |
setJsonView(Class<?> jsonView) |
void |
setModuleClassNames(String moduleClassNames)
To use custom Jackson
Module s specified as a String with FQN
class names. |
void |
setModuleRefs(String moduleRefs)
To use custom Jackson modules referred from the Camel registry.
|
void |
setModules(List<com.fasterxml.jackson.databind.Module> modules)
To use custom Jackson
Module s |
void |
setPrettyPrint(boolean prettyPrint) |
void |
setTimezone(TimeZone timezone)
If set then Jackson will use the Timezone when marshalling/unmarshalling.
|
void |
setUnmarshalType(Class<?> unmarshalType) |
void |
setUseList(boolean useList) |
void |
setXmlMapper(com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper) |
Object |
unmarshal(org.apache.camel.Exchange exchange,
InputStream stream) |
void |
useList()
Uses
ArrayList when unmarshalling. |
void |
useMap()
Uses
HashMap when unmarshalling. |
public JacksonXMLDataFormat()
XmlMapper
and Map
public JacksonXMLDataFormat(Class<?> unmarshalType)
XmlMapper
and with a custom unmarshal
typeunmarshalType
- the custom unmarshal typepublic JacksonXMLDataFormat(Class<?> unmarshalType, Class<?> jsonView)
XmlMapper
and with a custom unmarshal
type and JSON viewunmarshalType
- the custom unmarshal typejsonView
- marker class to specify properties to be included during
marshalling. See also
http://wiki.fasterxml.com/JacksonJsonViewspublic JacksonXMLDataFormat(Class<?> unmarshalType, Class<?> jsonView, boolean enableJaxbAnnotationModule)
XmlMapper
and with a custom unmarshal
type and JSON viewunmarshalType
- the custom unmarshal typejsonView
- marker class to specify properties to be included during
marshalling. See also
http://wiki.fasterxml.com/JacksonJsonViewsenableJaxbAnnotationModule
- if it is true, will enable the
JaxbAnnotationModule.public JacksonXMLDataFormat(com.fasterxml.jackson.dataformat.xml.XmlMapper mapper, Class<?> unmarshalType)
mapper
- the custom mapperunmarshalType
- the custom unmarshal typepublic JacksonXMLDataFormat(com.fasterxml.jackson.dataformat.xml.XmlMapper mapper, Class<?> unmarshalType, Class<?> jsonView)
mapper
- the custom mapperunmarshalType
- the custom unmarshal typejsonView
- marker class to specify properties to be included during
marshalling. See also
http://wiki.fasterxml.com/JacksonJsonViewspublic String getDataFormatName()
getDataFormatName
in interface org.apache.camel.spi.DataFormatName
public org.apache.camel.CamelContext getCamelContext()
getCamelContext
in interface org.apache.camel.CamelContextAware
public void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext
in interface org.apache.camel.CamelContextAware
public void marshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream) throws Exception
marshal
in interface org.apache.camel.spi.DataFormat
Exception
public Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream) throws Exception
unmarshal
in interface org.apache.camel.spi.DataFormat
Exception
public com.fasterxml.jackson.dataformat.xml.XmlMapper getXmlMapper()
public void setXmlMapper(com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper)
public Class<?> getUnmarshalType()
public void setUnmarshalType(Class<?> unmarshalType)
public Class<? extends Collection> getCollectionType()
public void setCollectionType(Class<? extends Collection> collectionType)
public Class<?> getJsonView()
public void setJsonView(Class<?> jsonView)
public String getInclude()
public void setInclude(String include)
public boolean isAllowJmsType()
public boolean isPrettyPrint()
public void setPrettyPrint(boolean prettyPrint)
public boolean isUseList()
public void setUseList(boolean useList)
public boolean isEnableJaxbAnnotationModule()
public void setEnableJaxbAnnotationModule(boolean enableJaxbAnnotationModule)
public List<com.fasterxml.jackson.databind.Module> getModules()
public void setModules(List<com.fasterxml.jackson.databind.Module> modules)
Module
spublic String getModuleClassNames()
public void addModule(com.fasterxml.jackson.databind.Module module)
public void setModuleClassNames(String moduleClassNames)
Module
s specified as a String with FQN
class names. Multiple classes can be separated by comma.public String getModuleRefs()
public void setModuleRefs(String moduleRefs)
public void useList()
ArrayList
when unmarshalling.public void useMap()
HashMap
when unmarshalling.public void setAllowJmsType(boolean allowJmsType)
public boolean isEnableJacksonTypeConverter()
public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter)
FallbackConverter
that attempts to convert
POJOs to/from Map
/List
types.
This should only be enabled when desired to be used.public boolean isAllowUnmarshallType()
public void setAllowUnmarshallType(boolean allowJacksonUnmarshallType)
public boolean isContentTypeHeader()
public void setContentTypeHeader(boolean contentTypeHeader)
public TimeZone getTimezone()
public void setTimezone(TimeZone timezone)
public String getEnableFeatures()
public void setEnableFeatures(String enableFeatures)
XmlMapper
. The features
should be a name that matches a enum from SerializationFeature
,
DeserializationFeature
, or MapperFeature
.public String getDisableFeatures()
public void setDisableFeatures(String disableFeatures)
XmlMapper
. The features
should be a name that matches a enum from SerializationFeature
,
DeserializationFeature
, or MapperFeature
.public void enableFeature(com.fasterxml.jackson.databind.SerializationFeature feature)
public void enableFeature(com.fasterxml.jackson.databind.DeserializationFeature feature)
public void enableFeature(com.fasterxml.jackson.databind.MapperFeature feature)
public void disableFeature(com.fasterxml.jackson.databind.SerializationFeature feature)
public void disableFeature(com.fasterxml.jackson.databind.DeserializationFeature feature)
public void disableFeature(com.fasterxml.jackson.databind.MapperFeature feature)
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.ServiceSupport
Exception
Apache Camel