Class JacksonTypeConverters

java.lang.Object
org.apache.camel.component.jackson.converter.JacksonTypeConverters

@Converter(generateLoader=true) public final class JacksonTypeConverters extends Object
Jackson TypeConverter that allows converting json to/from POJOs and other types.
This implementation uses a fallback converter.

The converter is disabled by default. To enable then set the property JacksonConstants.ENABLE_TYPE_CONVERTER to true on CamelContext.getGlobalOptions().
The option JacksonConstants.TYPE_CONVERTER_TO_POJO can be used to allow converting to POJO types. By default the converter only attempts to convert to primitive types such as String and numbers. To convert to any kind, then enable this by setting JacksonConstants.TYPE_CONVERTER_TO_POJO to true on CamelContext.getGlobalOptions().

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    convertTo(Class<T> type, org.apache.camel.Exchange exchange, Object value, org.apache.camel.spi.TypeConverterRegistry registry)
     
    toBoolean(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    byte[]
    toByteArray(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    toDouble(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    toFloat(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    toInputStream(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    toInteger(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    com.fasterxml.jackson.databind.JsonNode
    toJsonNode(byte[] arr, org.apache.camel.Exchange exchange)
     
    com.fasterxml.jackson.databind.JsonNode
    toJsonNode(File file, org.apache.camel.Exchange exchange)
     
    com.fasterxml.jackson.databind.JsonNode
    toJsonNode(InputStream is, org.apache.camel.Exchange exchange)
     
    com.fasterxml.jackson.databind.JsonNode
    toJsonNode(Reader reader, org.apache.camel.Exchange exchange)
     
    com.fasterxml.jackson.databind.JsonNode
    toJsonNode(String text, org.apache.camel.Exchange exchange)
     
    com.fasterxml.jackson.databind.JsonNode
    toJsonNode(Map map, org.apache.camel.Exchange exchange)
     
    toLong(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    toMap(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    toReader(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     
    toString(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JacksonTypeConverters

      public JacksonTypeConverters()
  • Method Details

    • toJsonNode

      @Converter public com.fasterxml.jackson.databind.JsonNode toJsonNode(String text, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toJsonNode

      @Converter public com.fasterxml.jackson.databind.JsonNode toJsonNode(byte[] arr, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toJsonNode

      @Converter public com.fasterxml.jackson.databind.JsonNode toJsonNode(InputStream is, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toJsonNode

      @Converter public com.fasterxml.jackson.databind.JsonNode toJsonNode(File file, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toJsonNode

      @Converter public com.fasterxml.jackson.databind.JsonNode toJsonNode(Reader reader, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toJsonNode

      @Converter public com.fasterxml.jackson.databind.JsonNode toJsonNode(Map map, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toString

      @Converter public String toString(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toByteArray

      @Converter public byte[] toByteArray(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toInputStream

      @Converter public InputStream toInputStream(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toMap

      @Converter public Map<String,Object> toMap(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toReader

      @Converter public Reader toReader(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toInteger

      @Converter public Integer toInteger(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toLong

      @Converter public Long toLong(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toBoolean

      @Converter public Boolean toBoolean(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toDouble

      @Converter public Double toDouble(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • toFloat

      @Converter public Float toFloat(com.fasterxml.jackson.databind.JsonNode node, org.apache.camel.Exchange exchange) throws Exception
      Throws:
      Exception
    • convertTo

      @Converter(fallback=true) public <T> T convertTo(Class<T> type, org.apache.camel.Exchange exchange, Object value, org.apache.camel.spi.TypeConverterRegistry registry) throws Exception
      Throws:
      Exception