camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickaroni <rgfa...@directv.com>
Subject Over-riding JSON deserializers/serializers in Camel w/o using annotations
Date Fri, 12 Sep 2014 21:35:37 GMT
Hi,

JSON libraries like Jackson and XStream provide ways of overriding the
serializers/deserializers that get used for various specific object types.

[While you can always hand-annotate code (e.g. with @JsonSerializer) to use
custom serializers and deserializers, that can be cumbersome and invasive.]

Some frameworks like Spring provide handy ways to do override the object to
serializer/deserializer mappings:  
http://docs.spring.io/spring/docs/current/javadoc-api/index.html?org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.html
<http://docs.spring.io/spring/docs/current/javadoc-api/index.html?org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.html>
 

How can I do the same kind of thing in Camel to override the converters
found in the the dataFormats section of camelContext?

e.g. How do can I change the converters that get used to convert to/from
MyObj1 and MyObj2 below?
  <camelContext>
......
      <dataFormats>
          <json id="MyObj1MarshallingJSON" 
unmarshalTypeName="com.blah.bleh.MyObj1"  library="Jackson" />
          <json id="MyObj2MarshallingJSON" 
unmarshalTypeName="com.blah.bleh.MyObj2"  library="XStream" />
      </dataFormats>

Thanks,
Rick




--
View this message in context: http://camel.465427.n5.nabble.com/Over-riding-JSON-deserializers-serializers-in-Camel-w-o-using-annotations-tp5756458.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message