Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ private void registerConverters(TypeConverterRegistry registry) {
(type, exchange, value) -> getJacksonTypeConverters().toReader((com.fasterxml.jackson.databind.JsonNode) value, exchange));
addTypeConverter(registry, java.lang.Boolean.class, com.fasterxml.jackson.databind.JsonNode.class, false,
(type, exchange, value) -> getJacksonTypeConverters().toBoolean((com.fasterxml.jackson.databind.JsonNode) value, exchange));
addTypeConverter(registry, java.lang.Boolean.class, com.fasterxml.jackson.databind.node.BooleanNode.class, false,
(type, exchange, value) -> getJacksonTypeConverters().toBoolean((com.fasterxml.jackson.databind.node.BooleanNode) value, exchange));
addTypeConverter(registry, java.lang.Double.class, com.fasterxml.jackson.databind.JsonNode.class, false,
(type, exchange, value) -> getJacksonTypeConverters().toDouble((com.fasterxml.jackson.databind.JsonNode) value, exchange));
addTypeConverter(registry, java.lang.Float.class, com.fasterxml.jackson.databind.JsonNode.class, false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,20 @@ public Long toLong(JsonNode node, Exchange exchange) throws Exception {
}

@Converter
public Boolean toBoolean(JsonNode node, Exchange exchange) throws Exception {
public Boolean toBoolean(BooleanNode node, Exchange exchange) throws Exception {
return node.asBoolean();
}

@Converter
public Boolean toBoolean(JsonNode node, Exchange exchange) throws Exception {
if (node instanceof BooleanNode) {
BooleanNode bn = (BooleanNode) node;
return bn.asBoolean();
}
String text = node.asText();
return org.apache.camel.util.ObjectHelper.toBoolean(text);
}

@Converter
public Double toDouble(JsonNode node, Exchange exchange) throws Exception {
if (node instanceof NumericNode) {
Expand Down