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/02270ab9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/02270ab9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/02270ab9

Branch: refs/heads/master
Commit: 02270ab9c90ac0d59b85dbd59fb9c1007eb44a1b
Parents: 2b0e961
Author: Andrea Cosentino <anco...@gmail.com>
Authored: Thu Dec 8 09:59:44 2016 +0100
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Thu Dec 8 09:59:44 2016 +0100

----------------------------------------------------------------------
 .../camel/model/dataformat/JsonDataFormat.java    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/02270ab9/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
 
b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index 4ee2413..c275b2a 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -73,6 +73,8 @@ public class JsonDataFormat extends DataFormatDefinition {
     private String disableFeatures;
     @XmlAttribute
     private String permissions;
+    @XmlAttribute
+    private Boolean allowUnmarshallType;
 
     public JsonDataFormat() {
         super("json");
@@ -303,6 +305,19 @@ public class JsonDataFormat extends DataFormatDefinition {
         setPermissions(csb.toString());
     }
 
+    public Boolean getAllowUnmarshallType() {
+        return allowUnmarshallType;
+    }
+
+    /**
+     * If enabled then Jackson is allowed to attempt to use the 
CamelJacksonUnmarshalType header during the unmarshalling.
+     * <p/>
+     * This should only be enabled when desired to be used.
+     */
+    public void setAllowUnmarshallType(Boolean allowUnmarshallType) {
+        this.allowUnmarshallType = allowUnmarshallType;
+    }
+
     @Override
     public String getDataFormatName() {
         // json data format is special as the name can be from different 
bundles
@@ -385,6 +400,9 @@ public class JsonDataFormat extends DataFormatDefinition {
         if (permissions != null) {
             setProperty(camelContext, dataFormat, "permissions", permissions);
         }
+        if (allowUnmarshallType != null) {
+            setProperty(camelContext, dataFormat, "allowUnmarshallType", 
allowUnmarshallType);
+        }
         // if we have the unmarshal type, but no permission set, then use it 
to be allowed
         if (permissions == null && unmarshalType != null) {
             String allow = "+" + unmarshalType.getName();

Reply via email to