CAMEL-10567: Camel-Jackson: Add an option to allow the UnmarshallType header use
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d4102512
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d4102512
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d4102512
Branch: refs/heads/camel-2.17.x
Commit: d4102512147eca2af21c3b6ed63a67d852f4e66a
Parents: 10f5526
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Thu Dec 8 09:51:19 2016 +0100
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Fri Dec 9 11:15:09 2016 +0100
----------------------------------------------------------------------
.../camel/component/jackson/JacksonDataFormat.java | 12 ++++++------
.../jackson/JacksonMarshalUnmarshalTypeHeaderTest.java | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d4102512/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
index 06dab04..78baa7a 100644
--- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
+++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
@@ -68,7 +68,7 @@ public class JacksonDataFormat extends ServiceSupport implements DataFormat,
Dat
private String enableFeatures;
private String disableFeatures;
private boolean enableJacksonTypeConverter;
- private boolean allowJacksonUnmarshallType;
+ private boolean allowUnmarshallType;
/**
* Use the default Jackson {@link ObjectMapper} and {@link Map}
@@ -160,7 +160,7 @@ public class JacksonDataFormat extends ServiceSupport implements DataFormat,
Dat
// is there a header with the unmarshal type?
Class<?> clazz = unmarshalType;
String type = null;
- if (allowJacksonUnmarshallType) {
+ if (allowUnmarshallType) {
type = exchange.getIn().getHeader(JacksonConstants.UNMARSHAL_TYPE, String.class);
}
if (type == null && isAllowJmsType()) {
@@ -331,8 +331,8 @@ public class JacksonDataFormat extends ServiceSupport implements DataFormat,
Dat
this.enableJacksonTypeConverter = enableJacksonTypeConverter;
}
- public boolean isAllowJacksonUnmarshallType() {
- return allowJacksonUnmarshallType;
+ public boolean isAllowUnmarshallType() {
+ return allowUnmarshallType;
}
/**
@@ -340,8 +340,8 @@ public class JacksonDataFormat extends ServiceSupport implements DataFormat,
Dat
* <p/>
* This should only be enabled when desired to be used.
*/
- public void setAllowJacksonUnmarshallType(boolean allowJacksonUnmarshallType) {
- this.allowJacksonUnmarshallType = allowJacksonUnmarshallType;
+ public void setAllowUnmarshallType(boolean allowJacksonUnmarshallType) {
+ this.allowUnmarshallType = allowJacksonUnmarshallType;
}
public String getEnableFeatures() {
http://git-wip-us.apache.org/repos/asf/camel/blob/d4102512/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalTypeHeaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalTypeHeaderTest.java
b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalTypeHeaderTest.java
index 623b32e..775e7ea 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalTypeHeaderTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalTypeHeaderTest.java
@@ -46,7 +46,7 @@ public class JacksonMarshalUnmarshalTypeHeaderTest extends CamelTestSupport
{
@Override
public void configure() throws Exception {
JacksonDataFormat format = new JacksonDataFormat();
- format.setAllowJacksonUnmarshallType(true);
+ format.setAllowUnmarshallType(true);
from("direct:backPojo").unmarshal(format).to("mock:reversePojo");
|