Class 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 Detail

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

        public String getDataFormatName()
        Specified by:
        getDataFormatName in interface org.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()
        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 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