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 JacksonObjectMapperandObjectCBORDataFormat(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Class<?> unmarshalType)Use the default CBOR JacksonObjectMapperand with a custom unmarshal type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisableFeature(com.fasterxml.jackson.databind.DeserializationFeature feature)voiddisableFeature(com.fasterxml.jackson.databind.MapperFeature feature)voiddisableFeature(com.fasterxml.jackson.databind.SerializationFeature feature)protected voiddoStart()protected voiddoStop()voidenableFeature(com.fasterxml.jackson.databind.DeserializationFeature feature)voidenableFeature(com.fasterxml.jackson.databind.MapperFeature feature)voidenableFeature(com.fasterxml.jackson.databind.SerializationFeature feature)org.apache.camel.CamelContextgetCamelContext()Class<? extends Collection>getCollectionType()StringgetDataFormatName()StringgetDisableFeatures()StringgetEnableFeatures()com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()Class<?>getUnmarshalType()booleanisAllowJmsType()booleanisAllowUnmarshallType()booleanisEnableJacksonTypeConverter()booleanisPrettyPrint()booleanisUseDefaultObjectMapper()booleanisUseList()voidmarshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream)voidsetAllowJmsType(boolean allowJmsType)Allows jackson to use the JMSType header as an indicator what the classname is for unmarshaling json content to POJOvoidsetAllowUnmarshallType(boolean allowUnmarshallType)voidsetCamelContext(org.apache.camel.CamelContext camelContext)voidsetCollectionType(Class<? extends Collection> collectionType)voidsetDisableFeatures(String disableFeatures)Set of features to disable on the JacksonObjectMapper.voidsetEnableFeatures(String enableFeatures)Set of features to enable on the JacksonObjectMapper.voidsetEnableJacksonTypeConverter(boolean enableJacksonTypeConverter)If enabled then Jackson is allowed to attempt to be used during Camels type converter as aFallbackConverterthat attempts to convert POJOs to/fromMap/Listtypes.voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)voidsetPrettyPrint(boolean prettyPrint)voidsetUnmarshalType(Class<?> unmarshalType)voidsetUseDefaultObjectMapper(boolean useDefaultObjectMapper)voidsetUseList(boolean useList)Objectunmarshal(org.apache.camel.Exchange exchange, InputStream stream)voiduseList()UsesArrayListwhen unmarshalling.voiduseMap()UsesHashMapwhen unmarshalling.-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, 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 JacksonObjectMapperandObject
-
CBORDataFormat
public CBORDataFormat(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Class<?> unmarshalType)Use the default CBOR JacksonObjectMapperand 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:
marshalin interfaceorg.apache.camel.spi.DataFormat- Throws:
Exception
-
unmarshal
public Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream) throws Exception
- Specified by:
unmarshalin interfaceorg.apache.camel.spi.DataFormat- Throws:
Exception
-
getDataFormatName
public String getDataFormatName()
- Specified by:
getDataFormatNamein 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()
UsesArrayListwhen unmarshalling.
-
useMap
public void useMap()
UsesHashMapwhen 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 aFallbackConverterthat attempts to convert POJOs to/fromMap/Listtypes. 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)
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
-