Class JacksonJsonAdapter
- java.lang.Object
-
- org.apache.camel.jsonpath.jackson.JacksonJsonAdapter
-
- All Implemented Interfaces:
JsonPathAdapter
public class JacksonJsonAdapter extends Object implements JsonPathAdapter
A JacksonJsonPathAdapter
which is using Jackson to convert the message body toMap
. This allows us to support POJO classes with camel-jsonpath.
-
-
Constructor Summary
Constructors Constructor Description JacksonJsonAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
init(org.apache.camel.CamelContext camelContext)
Initializes the adapterMap
readValue(Object body, org.apache.camel.Exchange exchange)
Attempt to read/convert the message body into aMap
typeString
writeAsString(Object value, org.apache.camel.Exchange exchange)
Attempts to write the value as a JSOnString
value.
-
-
-
Method Detail
-
init
public void init(org.apache.camel.CamelContext camelContext)
Description copied from interface:JsonPathAdapter
Initializes the adapter- Specified by:
init
in interfaceJsonPathAdapter
- Parameters:
camelContext
- the CamelContext
-
readValue
public Map readValue(Object body, org.apache.camel.Exchange exchange)
Description copied from interface:JsonPathAdapter
Attempt to read/convert the message body into aMap
type- Specified by:
readValue
in interfaceJsonPathAdapter
- Parameters:
body
- the message bodyexchange
- the Camel exchange- Returns:
- converted as
Map
or null if not possible
-
writeAsString
public String writeAsString(Object value, org.apache.camel.Exchange exchange)
Description copied from interface:JsonPathAdapter
Attempts to write the value as a JSOnString
value.- Specified by:
writeAsString
in interfaceJsonPathAdapter
- Parameters:
value
- the valueexchange
- the Camel exchange- Returns:
- written as
String
JSON or null if not possible
-
-