Package org.apache.camel.component.cbor
Class CBORDataFormat
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.component.cbor.CBORDataFormat
-
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.DataFormat
,org.apache.camel.spi.DataFormatName
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@Dataformat("cbor") public class CBORDataFormat extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName
-
-
Constructor Summary
Constructors Constructor Description CBORDataFormat()
Use the default CBOR JacksonObjectMapper
andObject
CBORDataFormat(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Class<?> unmarshalType)
Use the default CBOR JacksonObjectMapper
and with a custom unmarshal type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
doInit()
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()
com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper()
Class<?>
getUnmarshalType()
boolean
isAllowJmsType()
boolean
isAllowUnmarshallType()
boolean
isEnableJacksonTypeConverter()
boolean
isPrettyPrint()
boolean
isUseDefaultObjectMapper()
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 json content to POJOvoid
setAllowUnmarshallType(boolean allowUnmarshallType)
void
setCamelContext(org.apache.camel.CamelContext camelContext)
void
setCollectionType(Class<? extends Collection> collectionType)
void
setDisableFeatures(String disableFeatures)
Set of features to disable on the JacksonObjectMapper
.void
setEnableFeatures(String enableFeatures)
Set of features to enable on the JacksonObjectMapper
.void
setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter)
If enabled then Jackson is allowed to attempt to be used during Camels type converter as aFallbackConverter
that attempts to convert POJOs to/fromMap
/List
types.void
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
void
setPrettyPrint(boolean prettyPrint)
void
setUnmarshalType(Class<?> unmarshalType)
void
setUseDefaultObjectMapper(boolean useDefaultObjectMapper)
void
setUseList(boolean useList)
Object
unmarshal(org.apache.camel.Exchange exchange, InputStream stream)
void
useList()
UsesArrayList
when unmarshalling.void
useMap()
UsesHashMap
when unmarshalling.-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
CBORDataFormat
public CBORDataFormat()
Use the default CBOR JacksonObjectMapper
andObject
-
CBORDataFormat
public CBORDataFormat(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Class<?> unmarshalType)
Use the default CBOR JacksonObjectMapper
and with a custom unmarshal type- Parameters:
unmarshalType
- the custom unmarshal type
-
-
Method Detail
-
marshal
public void marshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream) throws Exception
- Specified by:
marshal
in interfaceorg.apache.camel.spi.DataFormat
- Throws:
Exception
-
unmarshal
public Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream) throws Exception
- Specified by:
unmarshal
in interfaceorg.apache.camel.spi.DataFormat
- Throws:
Exception
-
getDataFormatName
public String getDataFormatName()
- Specified by:
getDataFormatName
in interfaceorg.apache.camel.spi.DataFormatName
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext)
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
getUnmarshalType
public Class<?> getUnmarshalType()
-
setUnmarshalType
public void setUnmarshalType(Class<?> unmarshalType)
-
isAllowUnmarshallType
public boolean isAllowUnmarshallType()
-
setAllowUnmarshallType
public void setAllowUnmarshallType(boolean allowUnmarshallType)
-
getCollectionType
public Class<? extends Collection> getCollectionType()
-
setCollectionType
public void setCollectionType(Class<? extends Collection> collectionType)
-
isUseList
public boolean isUseList()
-
setUseList
public void setUseList(boolean useList)
-
isUseDefaultObjectMapper
public boolean isUseDefaultObjectMapper()
-
setUseDefaultObjectMapper
public void setUseDefaultObjectMapper(boolean useDefaultObjectMapper)
-
useList
public void useList()
UsesArrayList
when unmarshalling.
-
useMap
public void useMap()
UsesHashMap
when unmarshalling.
-
isPrettyPrint
public boolean isPrettyPrint()
-
setPrettyPrint
public void setPrettyPrint(boolean prettyPrint)
-
setAllowJmsType
public void setAllowJmsType(boolean allowJmsType)
Allows jackson to use the JMSType header as an indicator what the classname is for unmarshaling json content to POJO By default this option is false.
-
isAllowJmsType
public boolean isAllowJmsType()
-
getEnableFeatures
public String getEnableFeatures()
-
isEnableJacksonTypeConverter
public boolean isEnableJacksonTypeConverter()
-
setEnableJacksonTypeConverter
public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter)
If enabled then Jackson is allowed to attempt to be used during Camels type converter as aFallbackConverter
that attempts to convert POJOs to/fromMap
/List
types. This should only be enabled when desired to be used.
-
setEnableFeatures
public void setEnableFeatures(String enableFeatures)
Set of features to enable on the JacksonObjectMapper
. The features should be a name that matches a enum fromSerializationFeature
,DeserializationFeature
, orMapperFeature
.
-
getDisableFeatures
public String getDisableFeatures()
-
setDisableFeatures
public void setDisableFeatures(String disableFeatures)
Set of features to disable on the JacksonObjectMapper
. The features should be a name that matches a enum fromSerializationFeature
,DeserializationFeature
, orMapperFeature
.
-
enableFeature
public void enableFeature(com.fasterxml.jackson.databind.SerializationFeature feature)
-
enableFeature
public void enableFeature(com.fasterxml.jackson.databind.DeserializationFeature feature)
-
enableFeature
public void enableFeature(com.fasterxml.jackson.databind.MapperFeature feature)
-
disableFeature
public void disableFeature(com.fasterxml.jackson.databind.SerializationFeature feature)
-
disableFeature
public void disableFeature(com.fasterxml.jackson.databind.DeserializationFeature feature)
-
disableFeature
public void disableFeature(com.fasterxml.jackson.databind.MapperFeature feature)
-
doInit
protected void doInit() throws Exception
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
-