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.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName, org.apache.camel.spi.HasCamelContext, 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, org.apache.camel.CamelContextAware
  • Constructor Details

    • CBORDataFormat

      public CBORDataFormat()
      Use the default CBOR Jackson ObjectMapper and Object
    • CBORDataFormat

      public CBORDataFormat(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Class<?> unmarshalType)
      Use the default CBOR Jackson ObjectMapper and with a custom unmarshal type
      Parameters:
      unmarshalType - the custom unmarshal type
  • Method Details

    • 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
    • unmarshal

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

      public String getDataFormatName()
      Specified by:
      getDataFormatName in interface org.apache.camel.spi.DataFormatName
    • getCamelContext

      public org.apache.camel.CamelContext getCamelContext()
      Specified by:
      getCamelContext in interface org.apache.camel.spi.HasCamelContext
    • setCamelContext

      public void setCamelContext(org.apache.camel.CamelContext camelContext)
      Specified by:
      setCamelContext in interface org.apache.camel.CamelContextAware
    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • setObjectMapper

      public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    • getUnmarshalTypeName

      public String getUnmarshalTypeName()
    • setUnmarshalTypeName

      public void setUnmarshalTypeName(String unmarshalTypeName)
    • getUnmarshalType

      public Class<?> getUnmarshalType()
    • setUnmarshalType

      public void setUnmarshalType(Class<?> unmarshalType)
    • isAllowUnmarshallType

      public boolean isAllowUnmarshallType()
    • setAllowUnmarshallType

      public void setAllowUnmarshallType(boolean allowUnmarshallType)
    • getCollectionTypeName

      public String getCollectionTypeName()
    • setCollectionTypeName

      public void setCollectionTypeName(String collectionTypeName)
    • 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()
      Uses ArrayList when unmarshalling.
    • useMap

      public void useMap()
      Uses HashMap 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 a
      invalid reference
      org.apache.camel.FallbackConverter
      that attempts to convert POJOs to/from Map/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 Jackson ObjectMapper. The features should be a name that matches a enum from SerializationFeature, DeserializationFeature, or MapperFeature.
    • getDisableFeatures

      public String getDisableFeatures()
    • setDisableFeatures

      public void setDisableFeatures(String disableFeatures)
      Set of features to disable on the Jackson ObjectMapper. The features should be a name that matches a enum from SerializationFeature, DeserializationFeature, or MapperFeature.
    • 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 class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception