Skip to content

Commit 57d01e2

Browse files
oscerddkulp
authored andcommitted
CAMEL-10567: Camel-Jackson: Add an option to allow the UnmarshallType header use
1 parent 235036d commit 57d01e2

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

Lines changed: 6 additions & 6 deletions
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 Map}
@@ -161,7 +161,7 @@ public Object unmarshal(Exchange exchange, InputStream stream) throws Exception
161161
// is there a header with the unmarshal type?
162162
Class<?> clazz = unmarshalType;
163163
String type = null;
164-
if (allowJacksonUnmarshallType) {
164+
if (allowUnmarshallType) {
165165
type = exchange.getIn().getHeader(JacksonConstants.UNMARSHAL_TYPE, String.class);
166166
}
167167
if (type == null && isAllowJmsType()) {
@@ -328,17 +328,17 @@ public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter) {
328328
this.enableJacksonTypeConverter = enableJacksonTypeConverter;
329329
}
330330

331-
public boolean isAllowJacksonUnmarshallType() {
332-
return allowJacksonUnmarshallType;
331+
public boolean isAllowUnmarshallType() {
332+
return allowUnmarshallType;
333333
}
334334

335335
/**
336336
* If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling.
337337
* <p/>
338338
* This should only be enabled when desired to be used.
339339
*/
340-
public void setAllowJacksonUnmarshallType(boolean allowJacksonUnmarshallType) {
341-
this.allowJacksonUnmarshallType = allowJacksonUnmarshallType;
340+
public void setAllowUnmarshallType(boolean allowJacksonUnmarshallType) {
341+
this.allowUnmarshallType = allowJacksonUnmarshallType;
342342
}
343343

344344
public String getEnableFeatures() {

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

Lines changed: 1 addition & 1 deletion
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)