Skip to content

Commit 2b0e961

Browse files
committed
CAMEL-10567: Camel-Jackson: Add an option to allow the UnmarshallType header use
1 parent 3c0b7d0 commit 2b0e961

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class JacksonDataFormat extends ServiceSupport implements DataFormat, Dat
6868
private String enableFeatures;
6969
private String disableFeatures;
7070
private boolean enableJacksonTypeConverter;
71-
private boolean allowJacksonUnmarshallType;
71+
private boolean allowUnmarshallType;
7272

7373
/**
7474
* Use the default Jackson {@link ObjectMapper} and {@link Object}
@@ -160,7 +160,7 @@ public Object unmarshal(Exchange exchange, InputStream stream) throws Exception
160160
// is there a header with the unmarshal type?
161161
Class<?> clazz = unmarshalType;
162162
String type = null;
163-
if (allowJacksonUnmarshallType) {
163+
if (allowUnmarshallType) {
164164
type = exchange.getIn().getHeader(JacksonConstants.UNMARSHAL_TYPE, String.class);
165165
}
166166
if (type == null && isAllowJmsType()) {
@@ -331,17 +331,17 @@ public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter) {
331331
this.enableJacksonTypeConverter = enableJacksonTypeConverter;
332332
}
333333

334-
public boolean isAllowJacksonUnmarshallType() {
335-
return allowJacksonUnmarshallType;
334+
public boolean isAllowUnmarshallType() {
335+
return allowUnmarshallType;
336336
}
337337

338338
/**
339339
* If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling.
340340
* <p/>
341341
* This should only be enabled when desired to be used.
342342
*/
343-
public void setAllowJacksonUnmarshallType(boolean allowJacksonUnmarshallType) {
344-
this.allowJacksonUnmarshallType = allowJacksonUnmarshallType;
343+
public void setAllowUnmarshallType(boolean allowJacksonUnmarshallType) {
344+
this.allowUnmarshallType = allowJacksonUnmarshallType;
345345
}
346346

347347
public String getEnableFeatures() {

components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalTypeHeaderTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected RouteBuilder createRouteBuilder() throws Exception {
4646
@Override
4747
public void configure() throws Exception {
4848
JacksonDataFormat format = new JacksonDataFormat();
49-
format.setAllowJacksonUnmarshallType(true);
49+
format.setAllowUnmarshallType(true);
5050

5151
from("direct:backPojo").unmarshal(format).to("mock:reversePojo");
5252

0 commit comments

Comments
 (0)