Skip to content

Commit

Permalink
CAMEL-10567: Camel-Jackson: Add an option to allow the UnmarshallType…
Browse files Browse the repository at this point in the history
… header use
  • Loading branch information
oscerd committed Dec 8, 2016
1 parent 3c0b7d0 commit 2b0e961
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 Object}
Expand Down Expand Up @@ -160,7 +160,7 @@ public Object unmarshal(Exchange exchange, InputStream stream) throws Exception
// 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()) {
Expand Down Expand Up @@ -331,17 +331,17 @@ public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter) {
this.enableJacksonTypeConverter = enableJacksonTypeConverter;
}

public boolean isAllowJacksonUnmarshallType() {
return allowJacksonUnmarshallType;
public boolean isAllowUnmarshallType() {
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 setAllowJacksonUnmarshallType(boolean allowJacksonUnmarshallType) {
this.allowJacksonUnmarshallType = allowJacksonUnmarshallType;
public void setAllowUnmarshallType(boolean allowJacksonUnmarshallType) {
this.allowUnmarshallType = allowJacksonUnmarshallType;
}

public String getEnableFeatures() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected RouteBuilder createRouteBuilder() throws Exception {
@Override
public void configure() throws Exception {
JacksonDataFormat format = new JacksonDataFormat();
format.setAllowJacksonUnmarshallType(true);
format.setAllowUnmarshallType(true);

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

Expand Down

0 comments on commit 2b0e961

Please sign in to comment.