You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/10/30 09:08:11 UTC

[camel] branch master updated (9b21d36 -> 58d91ce)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 9b21d36  Regen
     new 18aa634  CAMEL-14101 - json-jackson dataformat: potential ObjectMapper configuration clashes
     new 193fe72  CAMEL-14101 - Regen
     new 83ec8eb  CAMEL-14101 - Use Boolean and not boolean in JsonDataFormat
     new 681ed35  CAMEL-14101 - Regen
     new e75c436  CAMEL-14101 - Fixed CS
     new 61ac81a  CAMEL-14101 - Fixed CS in camel-core-engine
     new 58d91ce  Regen

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/docs/json-fastjson-dataformat.adoc    |   6 +-
 .../src/main/docs/json-gson-dataformat.adoc        |   6 +-
 .../src/main/docs/json-jackson-dataformat.adoc     |   6 +-
 .../camel/component/jackson/JacksonDataFormat.java | 207 ++++++++++++---------
 .../component/jackson/ListJacksonDataFormat.java   |   5 +-
 .../jackson/converter/JacksonTypeConverters.java   |  48 ++---
 .../component/jackson/JacksonConcurrentTest.java   |   9 +-
 .../component/jackson/JacksonDataFormatTest.java   |   2 +-
 .../jackson/JacksonJsonDataFormatTest.java         |   2 +-
 .../jackson/JacksonMarshalDateTimezoneTest.java    |   3 +-
 .../jackson/JacksonMarshalUnmarshalListTest.java   |   6 +-
 .../JacksonNotUseDefaultObjectMapperTest.java      |   3 +-
 .../jackson/JacksonObjectListSplitTest.java        |   7 +-
 .../jackson/JacksonObjectMapperRegistryTest.java   |   9 +-
 .../SpringJacksonMarshalUnmarshalListTest.java     |   6 +-
 .../SpringJacksonObjectMapperRegistryTest.java     |   4 +-
 .../camel/component/jackson/TestJAXBPojo.java      |   4 +-
 .../camel/component/jackson/TestOtherPojo.java     |   2 +-
 .../apache/camel/component/jackson/TestPojo.java   |   4 +-
 .../camel/component/jackson/TestPojoView.java      |   6 +-
 .../org/apache/camel/component/jackson/Views.java  |   7 +-
 .../converter/JacksonConversionsPojoTest.java      |   5 +-
 .../converter/JacksonConversionsSimpleTest.java    |   3 +-
 .../jackson/converter/JacksonConversionsTest.java  |   5 +-
 .../src/main/docs/json-johnzon-dataformat.adoc     |   6 +-
 .../src/main/docs/json-xstream-dataformat.adoc     |   3 +-
 .../src/main/docs/xstream-dataformat.adoc          |   3 +-
 .../camel/model/dataformat/JsonDataFormat.java     |  15 ++
 .../ROOT/pages/json-fastjson-dataformat.adoc       |   6 +-
 .../modules/ROOT/pages/json-gson-dataformat.adoc   |   6 +-
 .../ROOT/pages/json-jackson-dataformat.adoc        |   6 +-
 .../ROOT/pages/json-johnzon-dataformat.adoc        |   6 +-
 .../ROOT/pages/json-xstream-dataformat.adoc        |   3 +-
 .../modules/ROOT/pages/xstream-dataformat.adoc     |   3 +-
 .../FastjsonDataFormatConfiguration.java           |  13 ++
 .../springboot/GsonDataFormatConfiguration.java    |  13 ++
 .../springboot/JacksonDataFormatConfiguration.java |  13 ++
 .../springboot/JohnzonDataFormatConfiguration.java |  13 ++
 .../springboot/JsonDataFormatConfiguration.java    |  13 ++
 39 files changed, 311 insertions(+), 176 deletions(-)


[camel] 05/07: CAMEL-14101 - Fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e75c436ccb3efc347ccc5b62db783a02a0d44a98
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 30 09:24:29 2019 +0100

    CAMEL-14101 - Fixed CS
---
 .../camel/component/jackson/JacksonDataFormat.java | 1137 ++++++++++----------
 .../component/jackson/ListJacksonDataFormat.java   |    5 +-
 .../jackson/converter/JacksonTypeConverters.java   |   48 +-
 .../component/jackson/JacksonConcurrentTest.java   |    9 +-
 .../component/jackson/JacksonDataFormatTest.java   |    2 +-
 .../jackson/JacksonJsonDataFormatTest.java         |    2 +-
 .../jackson/JacksonMarshalDateTimezoneTest.java    |    3 +-
 .../jackson/JacksonMarshalUnmarshalListTest.java   |    6 +-
 .../JacksonNotUseDefaultObjectMapperTest.java      |    3 +-
 .../jackson/JacksonObjectListSplitTest.java        |    7 +-
 .../jackson/JacksonObjectMapperRegistryTest.java   |    8 +-
 .../SpringJacksonMarshalUnmarshalListTest.java     |    6 +-
 .../SpringJacksonObjectMapperRegistryTest.java     |    4 +-
 .../camel/component/jackson/TestJAXBPojo.java      |    4 +-
 .../camel/component/jackson/TestOtherPojo.java     |    2 +-
 .../apache/camel/component/jackson/TestPojo.java   |    4 +-
 .../camel/component/jackson/TestPojoView.java      |    6 +-
 .../org/apache/camel/component/jackson/Views.java  |    7 +-
 .../converter/JacksonConversionsPojoTest.java      |    5 +-
 .../converter/JacksonConversionsSimpleTest.java    |    3 +-
 .../jackson/converter/JacksonConversionsTest.java  |    5 +-
 21 files changed, 641 insertions(+), 635 deletions(-)

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 c205e3b..35f5e4b 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
@@ -53,575 +53,572 @@ import org.apache.camel.support.service.ServiceSupport;
 @Dataformat("json-jackson")
 public class JacksonDataFormat extends ServiceSupport implements DataFormat, DataFormatName, CamelContextAware {
 
-	private CamelContext camelContext;
-	private ObjectMapper objectMapper;
-	private boolean useDefaultObjectMapper = true;
-	private Class<? extends Collection> collectionType;
-	private List<Module> modules;
-	private String moduleClassNames;
-	private String moduleRefs;
-	private Class<?> unmarshalType;
-	private Class<?> jsonView;
-	private String include;
-	private boolean prettyPrint;
-	private boolean allowJmsType;
-	private boolean useList;
-	private boolean enableJaxbAnnotationModule;
-	private String enableFeatures;
-	private String disableFeatures;
-	private boolean enableJacksonTypeConverter;
-	private boolean allowUnmarshallType;
-	private boolean contentTypeHeader = true;
-	private TimeZone timezone;
-	private boolean autoDiscoverObjectMapper;
-
-	/**
-	 * Use the default Jackson {@link ObjectMapper} and {@link Object}
-	 */
-	public JacksonDataFormat() {
-		this(Object.class);
-	}
-
-	/**
-	 * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal type
-	 *
-	 * @param unmarshalType the custom unmarshal type
-	 */
-	public JacksonDataFormat(Class<?> unmarshalType) {
-		this(unmarshalType, null);
-	}
-
-	/**
-	 * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal type
-	 * and JSON view
-	 *
-	 * @param unmarshalType the custom unmarshal type
-	 * @param jsonView      marker class to specify properties to be included during
-	 *                      marshalling. See also
-	 *                      http://wiki.fasterxml.com/JacksonJsonViews
-	 */
-	public JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView) {
-		this(unmarshalType, jsonView, true);
-	}
-
-	/**
-	 * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal type
-	 * and JSON view
-	 *
-	 * @param unmarshalType              the custom unmarshal type
-	 * @param jsonView                   marker class to specify properties to be
-	 *                                   included during marshalling. See also
-	 *                                   http://wiki.fasterxml.com/JacksonJsonViews
-	 * @param enableJaxbAnnotationModule if it is true, will enable the
-	 *                                   JaxbAnnotationModule.
-	 */
-	public JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView, boolean enableJaxbAnnotationModule) {
-		this.unmarshalType = unmarshalType;
-		this.jsonView = jsonView;
-		this.enableJaxbAnnotationModule = enableJaxbAnnotationModule;
-	}
-
-	/**
-	 * Use a custom Jackson mapper and and unmarshal type
-	 *
-	 * @param mapper        the custom mapper
-	 * @param unmarshalType the custom unmarshal type
-	 */
-	public JacksonDataFormat(ObjectMapper mapper, Class<?> unmarshalType) {
-		this(mapper, unmarshalType, null);
-	}
-
-	/**
-	 * Use a custom Jackson mapper, unmarshal type and JSON view
-	 *
-	 * @param mapper        the custom mapper
-	 * @param unmarshalType the custom unmarshal type
-	 * @param jsonView      marker class to specify properties to be included during
-	 *                      marshalling. See also
-	 *                      http://wiki.fasterxml.com/JacksonJsonViews
-	 */
-	public JacksonDataFormat(ObjectMapper mapper, Class<?> unmarshalType, Class<?> jsonView) {
-		this.objectMapper = mapper;
-		this.unmarshalType = unmarshalType;
-		this.jsonView = jsonView;
-	}
-
-	@Override
-	public String getDataFormatName() {
-		return "json-jackson";
-	}
-
-	@Override
-	public CamelContext getCamelContext() {
-		return camelContext;
-	}
-
-	@Override
-	public void setCamelContext(CamelContext camelContext) {
-		this.camelContext = camelContext;
-	}
-
-	@Override
-	public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
-		this.objectMapper.writerWithView(jsonView).writeValue(stream, graph);
-
-		if (contentTypeHeader) {
-			if (exchange.hasOut()) {
-				exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/json");
-			} else {
-				exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json");
-			}
-		}
-	}
-
-	@Override
-	public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
-
-		// is there a header with the unmarshal type?
-		Class<?> clazz = unmarshalType;
-		String type = null;
-		if (allowUnmarshallType) {
-			type = exchange.getIn().getHeader(JacksonConstants.UNMARSHAL_TYPE, String.class);
-		}
-		if (type == null && isAllowJmsType()) {
-			type = exchange.getIn().getHeader("JMSType", String.class);
-		}
-		if (type != null) {
-			clazz = exchange.getContext().getClassResolver().resolveMandatoryClass(type);
-		}
-		if (collectionType != null) {
-			CollectionType collType = objectMapper.getTypeFactory().constructCollectionType(collectionType, clazz);
-			return this.objectMapper.readValue(stream, collType);
-		} else {
-			return this.objectMapper.readValue(stream, clazz);
-		}
-	}
-
-	// Properties
-	// -------------------------------------------------------------------------
-
-	public ObjectMapper getObjectMapper() {
-		return this.objectMapper;
-	}
-
-	public void setObjectMapper(ObjectMapper objectMapper) {
-		this.objectMapper = objectMapper;
-	}
-
-	public boolean isUseDefaultObjectMapper() {
-		return useDefaultObjectMapper;
-	}
-
-	public void setUseDefaultObjectMapper(boolean useDefaultObjectMapper) {
-		this.useDefaultObjectMapper = useDefaultObjectMapper;
-	}
-
-	public Class<?> getUnmarshalType() {
-		return this.unmarshalType;
-	}
-
-	public void setUnmarshalType(Class<?> unmarshalType) {
-		this.unmarshalType = unmarshalType;
-	}
-
-	public Class<? extends Collection> getCollectionType() {
-		return collectionType;
-	}
-
-	public void setCollectionType(Class<? extends Collection> collectionType) {
-		this.collectionType = collectionType;
-	}
-
-	public Class<?> getJsonView() {
-		return jsonView;
-	}
-
-	public void setJsonView(Class<?> jsonView) {
-		this.jsonView = jsonView;
-	}
-
-	public String getInclude() {
-		return include;
-	}
-
-	public void setInclude(String include) {
-		this.include = include;
-	}
-
-	public boolean isAllowJmsType() {
-		return allowJmsType;
-	}
-
-	public boolean isPrettyPrint() {
-		return prettyPrint;
-	}
-
-	public void setPrettyPrint(boolean prettyPrint) {
-		this.prettyPrint = prettyPrint;
-	}
-
-	public boolean isUseList() {
-		return useList;
-	}
-
-	public void setUseList(boolean useList) {
-		this.useList = useList;
-	}
-
-	public boolean isEnableJaxbAnnotationModule() {
-		return enableJaxbAnnotationModule;
-	}
-
-	public void setEnableJaxbAnnotationModule(boolean enableJaxbAnnotationModule) {
-		this.enableJaxbAnnotationModule = enableJaxbAnnotationModule;
-	}
-
-	public List<Module> getModules() {
-		return modules;
-	}
-
-	/**
-	 * To use custom Jackson {@link Module}s
-	 */
-	public void setModules(List<Module> modules) {
-		this.modules = modules;
-	}
-
-	public String getModuleClassNames() {
-		return moduleClassNames;
-	}
-
-	/**
-	 * To use the custom Jackson module
-	 */
-	public void addModule(Module module) {
-		if (this.modules == null) {
-			this.modules = new ArrayList<>();
-		}
-		this.modules.add(module);
-	}
-
-	/**
-	 * To use custom Jackson {@link Module}s specified as a String with FQN class
-	 * names. Multiple classes can be separated by comma.
-	 */
-	public void setModuleClassNames(String moduleClassNames) {
-		this.moduleClassNames = moduleClassNames;
-	}
-
-	public String getModuleRefs() {
-		return moduleRefs;
-	}
-
-	/**
-	 * To use custom Jackson modules referred from the Camel registry. Multiple
-	 * modules can be separated by comma.
-	 */
-	public void setModuleRefs(String moduleRefs) {
-		this.moduleRefs = moduleRefs;
-	}
-
-	/**
-	 * Uses {@link java.util.ArrayList} when unmarshalling.
-	 */
-	public void useList() {
-		setCollectionType(ArrayList.class);
-	}
-
-	/**
-	 * Uses {@link java.util.HashMap} when unmarshalling.
-	 */
-	public void useMap() {
-		setCollectionType(null);
-		setUnmarshalType(HashMap.class);
-	}
-
-	/**
-	 * Allows jackson to use the <tt>JMSType</tt> header as an indicator what the
-	 * classname is for unmarshaling json content to POJO
-	 * <p/>
-	 * By default this option is <tt>false</tt>.
-	 */
-	public void setAllowJmsType(boolean allowJmsType) {
-		this.allowJmsType = allowJmsType;
-	}
-
-	public boolean isEnableJacksonTypeConverter() {
-		return enableJacksonTypeConverter;
-	}
-
-	/**
-	 * If enabled then Jackson is allowed to attempt to be used during Camels
-	 * <a href="https://camel.apache.org/type-converter.html">type converter</a> as
-	 * a {@link org.apache.camel.FallbackConverter} that attempts to convert POJOs
-	 * to/from {@link Map}/{@link List} types.
-	 * <p/>
-	 * This should only be enabled when desired to be used.
-	 */
-	public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter) {
-		this.enableJacksonTypeConverter = enableJacksonTypeConverter;
-	}
-
-	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 setAllowUnmarshallType(boolean allowJacksonUnmarshallType) {
-		this.allowUnmarshallType = allowJacksonUnmarshallType;
-	}
-
-	public boolean isContentTypeHeader() {
-		return contentTypeHeader;
-	}
-
-	/**
-	 * If enabled then Jackson will set the Content-Type header to
-	 * <tt>application/json</tt> when marshalling.
-	 */
-	public void setContentTypeHeader(boolean contentTypeHeader) {
-		this.contentTypeHeader = contentTypeHeader;
-	}
-
-	public TimeZone getTimezone() {
-		return timezone;
-	}
-
-	/**
-	 * If set then Jackson will use the Timezone when marshalling/unmarshalling.
-	 */
-	public void setTimezone(TimeZone timezone) {
-		this.timezone = timezone;
-	}
-
-	public boolean isAutoDiscoverObjectMapper() {
-		return autoDiscoverObjectMapper;
-	}
-
-	/**
-	 * If set to true then Jackson will lookup for an objectMapper into the registry
-	 */
-	public void setAutoDiscoverObjectMapper(boolean autoDiscoverObjectMapper) {
-		this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
-	}
-
-	public String getEnableFeatures() {
-		return enableFeatures;
-	}
-
-	/**
-	 * Set of features to enable on the Jackson {@link ObjectMapper}. The features
-	 * should be a name that matches a enum from {@link SerializationFeature},
-	 * {@link DeserializationFeature}, or {@link MapperFeature}.
-	 */
-	public void setEnableFeatures(String enableFeatures) {
-		this.enableFeatures = enableFeatures;
-	}
-
-	public String getDisableFeatures() {
-		return disableFeatures;
-	}
-
-	/**
-	 * Set of features to disable on the Jackson {@link ObjectMapper}. The features
-	 * should be a name that matches a enum from {@link SerializationFeature},
-	 * {@link DeserializationFeature}, or {@link MapperFeature}.
-	 */
-	public void setDisableFeatures(String disableFeatures) {
-		this.disableFeatures = disableFeatures;
-	}
-
-	public void enableFeature(SerializationFeature feature) {
-		if (enableFeatures == null) {
-			enableFeatures = feature.name();
-		} else {
-			enableFeatures += "," + feature.name();
-		}
-	}
-
-	public void enableFeature(DeserializationFeature feature) {
-		if (enableFeatures == null) {
-			enableFeatures = feature.name();
-		} else {
-			enableFeatures += "," + feature.name();
-		}
-	}
-
-	public void enableFeature(MapperFeature feature) {
-		if (enableFeatures == null) {
-			enableFeatures = feature.name();
-		} else {
-			enableFeatures += "," + feature.name();
-		}
-	}
-
-	public void disableFeature(SerializationFeature feature) {
-		if (disableFeatures == null) {
-			disableFeatures = feature.name();
-		} else {
-			disableFeatures += "," + feature.name();
-		}
-	}
-
-	public void disableFeature(DeserializationFeature feature) {
-		if (disableFeatures == null) {
-			disableFeatures = feature.name();
-		} else {
-			disableFeatures += "," + feature.name();
-		}
-	}
-
-	public void disableFeature(MapperFeature feature) {
-		if (disableFeatures == null) {
-			disableFeatures = feature.name();
-		} else {
-			disableFeatures += "," + feature.name();
-		}
-	}
-
-	@Override
-	protected void doStart() throws Exception {
-		boolean objectMapperFoundRegistry = false;
-		if (objectMapper == null) {
-			// lookup if there is a single default mapper we can use
-			if (useDefaultObjectMapper && camelContext != null) {
-				if (isAutoDiscoverObjectMapper()) {
-					Set<ObjectMapper> set = camelContext.getRegistry().findByType(ObjectMapper.class);
-					if (set.size() == 1) {
-						objectMapper = set.iterator().next();
-						log.info("Found single ObjectMapper in Registry to use: {}", objectMapper);
-						objectMapperFoundRegistry = true;
-					} else if (set.size() > 1) {
-						log.debug(
-								"Found {} ObjectMapper in Registry cannot use as default as there are more than one instance.",
-								set.size());
-					}
-				} else {
-					log.warn("The option autoDiscoverObjectMapper is set to false, Camel won't search in the registry");
-				}
-			}
-			if (objectMapper == null) {
-				objectMapper = new ObjectMapper();
-				log.debug("Creating new ObjectMapper to use: {}", objectMapper);
-			}
-		}
-
-		if (!objectMapperFoundRegistry) {
-			if (enableJaxbAnnotationModule) {
-				// Enables JAXB processing
-				JaxbAnnotationModule module = new JaxbAnnotationModule();
-				log.debug("Registering JaxbAnnotationModule: {}", module);
-				objectMapper.registerModule(module);
-			}
-
-			if (useList) {
-				setCollectionType(ArrayList.class);
-			}
-			if (include != null) {
-				JsonInclude.Include inc = getCamelContext().getTypeConverter()
-						.mandatoryConvertTo(JsonInclude.Include.class, include);
-				objectMapper.setSerializationInclusion(inc);
-			}
-			if (prettyPrint) {
-				objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
-			}
-
-			if (enableFeatures != null) {
-				Iterator<?> it = ObjectHelper.createIterator(enableFeatures);
-				while (it.hasNext()) {
-					String enable = it.next().toString();
-					// it can be different kind
-					SerializationFeature sf = getCamelContext().getTypeConverter()
-							.tryConvertTo(SerializationFeature.class, enable);
-					if (sf != null) {
-						objectMapper.enable(sf);
-						continue;
-					}
-					DeserializationFeature df = getCamelContext().getTypeConverter()
-							.tryConvertTo(DeserializationFeature.class, enable);
-					if (df != null) {
-						objectMapper.enable(df);
-						continue;
-					}
-					MapperFeature mf = getCamelContext().getTypeConverter().tryConvertTo(MapperFeature.class, enable);
-					if (mf != null) {
-						objectMapper.enable(mf);
-						continue;
-					}
-					throw new IllegalArgumentException("Enable feature: " + enable
-							+ " cannot be converted to an accepted enum of types [SerializationFeature,DeserializationFeature,MapperFeature]");
-				}
-			}
-			if (disableFeatures != null) {
-				Iterator<?> it = ObjectHelper.createIterator(disableFeatures);
-				while (it.hasNext()) {
-					String disable = it.next().toString();
-					// it can be different kind
-					SerializationFeature sf = getCamelContext().getTypeConverter()
-							.tryConvertTo(SerializationFeature.class, disable);
-					if (sf != null) {
-						objectMapper.disable(sf);
-						continue;
-					}
-					DeserializationFeature df = getCamelContext().getTypeConverter()
-							.tryConvertTo(DeserializationFeature.class, disable);
-					if (df != null) {
-						objectMapper.disable(df);
-						continue;
-					}
-					MapperFeature mf = getCamelContext().getTypeConverter().tryConvertTo(MapperFeature.class, disable);
-					if (mf != null) {
-						objectMapper.disable(mf);
-						continue;
-					}
-					throw new IllegalArgumentException("Disable feature: " + disable
-							+ " cannot be converted to an accepted enum of types [SerializationFeature,DeserializationFeature,MapperFeature]");
-				}
-			}
-
-			if (modules != null) {
-				for (Module module : modules) {
-					log.debug("Registering module: {}", module);
-					objectMapper.registerModules(module);
-				}
-			}
-			if (moduleClassNames != null) {
-				Iterable<?> it = ObjectHelper.createIterable(moduleClassNames);
-				for (Object o : it) {
-					String name = o.toString();
-					Class<Module> clazz = camelContext.getClassResolver().resolveMandatoryClass(name, Module.class);
-					Module module = camelContext.getInjector().newInstance(clazz);
-					log.debug("Registering module: {} -> {}", name, module);
-					objectMapper.registerModule(module);
-				}
-			}
-			if (moduleRefs != null) {
-				Iterable<?> it = ObjectHelper.createIterable(moduleRefs);
-				for (Object o : it) {
-					String name = o.toString();
-					if (name.startsWith("#")) {
-						name = name.substring(1);
-					}
-					Module module = CamelContextHelper.mandatoryLookup(camelContext, name, Module.class);
-					log.debug("Registering module: {} -> {}", name, module);
-					objectMapper.registerModule(module);
-				}
-			}
-			if (org.apache.camel.util.ObjectHelper.isNotEmpty(timezone)) {
-				log.debug("Setting timezone to Object Mapper: {}", timezone);
-				objectMapper.setTimeZone(timezone);
-			}
-		}
-	}
-
-	@Override
-	protected void doStop() throws Exception {
-		// noop
-	}
+    private CamelContext camelContext;
+    private ObjectMapper objectMapper;
+    private boolean useDefaultObjectMapper = true;
+    private Class<? extends Collection> collectionType;
+    private List<Module> modules;
+    private String moduleClassNames;
+    private String moduleRefs;
+    private Class<?> unmarshalType;
+    private Class<?> jsonView;
+    private String include;
+    private boolean prettyPrint;
+    private boolean allowJmsType;
+    private boolean useList;
+    private boolean enableJaxbAnnotationModule;
+    private String enableFeatures;
+    private String disableFeatures;
+    private boolean enableJacksonTypeConverter;
+    private boolean allowUnmarshallType;
+    private boolean contentTypeHeader = true;
+    private TimeZone timezone;
+    private boolean autoDiscoverObjectMapper;
+
+    /**
+     * Use the default Jackson {@link ObjectMapper} and {@link Object}
+     */
+    public JacksonDataFormat() {
+        this(Object.class);
+    }
+
+    /**
+     * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal
+     * type
+     *
+     * @param unmarshalType the custom unmarshal type
+     */
+    public JacksonDataFormat(Class<?> unmarshalType) {
+        this(unmarshalType, null);
+    }
+
+    /**
+     * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal
+     * type and JSON view
+     *
+     * @param unmarshalType the custom unmarshal type
+     * @param jsonView marker class to specify properties to be included during
+     *            marshalling. See also
+     *            http://wiki.fasterxml.com/JacksonJsonViews
+     */
+    public JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView) {
+        this(unmarshalType, jsonView, true);
+    }
+
+    /**
+     * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal
+     * type and JSON view
+     *
+     * @param unmarshalType the custom unmarshal type
+     * @param jsonView marker class to specify properties to be included during
+     *            marshalling. See also
+     *            http://wiki.fasterxml.com/JacksonJsonViews
+     * @param enableJaxbAnnotationModule if it is true, will enable the
+     *            JaxbAnnotationModule.
+     */
+    public JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView, boolean enableJaxbAnnotationModule) {
+        this.unmarshalType = unmarshalType;
+        this.jsonView = jsonView;
+        this.enableJaxbAnnotationModule = enableJaxbAnnotationModule;
+    }
+
+    /**
+     * Use a custom Jackson mapper and and unmarshal type
+     *
+     * @param mapper the custom mapper
+     * @param unmarshalType the custom unmarshal type
+     */
+    public JacksonDataFormat(ObjectMapper mapper, Class<?> unmarshalType) {
+        this(mapper, unmarshalType, null);
+    }
+
+    /**
+     * Use a custom Jackson mapper, unmarshal type and JSON view
+     *
+     * @param mapper the custom mapper
+     * @param unmarshalType the custom unmarshal type
+     * @param jsonView marker class to specify properties to be included during
+     *            marshalling. See also
+     *            http://wiki.fasterxml.com/JacksonJsonViews
+     */
+    public JacksonDataFormat(ObjectMapper mapper, Class<?> unmarshalType, Class<?> jsonView) {
+        this.objectMapper = mapper;
+        this.unmarshalType = unmarshalType;
+        this.jsonView = jsonView;
+    }
+
+    @Override
+    public String getDataFormatName() {
+        return "json-jackson";
+    }
+
+    @Override
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    @Override
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
+    @Override
+    public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
+        this.objectMapper.writerWithView(jsonView).writeValue(stream, graph);
+
+        if (contentTypeHeader) {
+            if (exchange.hasOut()) {
+                exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/json");
+            } else {
+                exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json");
+            }
+        }
+    }
+
+    @Override
+    public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+
+        // is there a header with the unmarshal type?
+        Class<?> clazz = unmarshalType;
+        String type = null;
+        if (allowUnmarshallType) {
+            type = exchange.getIn().getHeader(JacksonConstants.UNMARSHAL_TYPE, String.class);
+        }
+        if (type == null && isAllowJmsType()) {
+            type = exchange.getIn().getHeader("JMSType", String.class);
+        }
+        if (type != null) {
+            clazz = exchange.getContext().getClassResolver().resolveMandatoryClass(type);
+        }
+        if (collectionType != null) {
+            CollectionType collType = objectMapper.getTypeFactory().constructCollectionType(collectionType, clazz);
+            return this.objectMapper.readValue(stream, collType);
+        } else {
+            return this.objectMapper.readValue(stream, clazz);
+        }
+    }
+
+    // Properties
+    // -------------------------------------------------------------------------
+
+    public ObjectMapper getObjectMapper() {
+        return this.objectMapper;
+    }
+
+    public void setObjectMapper(ObjectMapper objectMapper) {
+        this.objectMapper = objectMapper;
+    }
+
+    public boolean isUseDefaultObjectMapper() {
+        return useDefaultObjectMapper;
+    }
+
+    public void setUseDefaultObjectMapper(boolean useDefaultObjectMapper) {
+        this.useDefaultObjectMapper = useDefaultObjectMapper;
+    }
+
+    public Class<?> getUnmarshalType() {
+        return this.unmarshalType;
+    }
+
+    public void setUnmarshalType(Class<?> unmarshalType) {
+        this.unmarshalType = unmarshalType;
+    }
+
+    public Class<? extends Collection> getCollectionType() {
+        return collectionType;
+    }
+
+    public void setCollectionType(Class<? extends Collection> collectionType) {
+        this.collectionType = collectionType;
+    }
+
+    public Class<?> getJsonView() {
+        return jsonView;
+    }
+
+    public void setJsonView(Class<?> jsonView) {
+        this.jsonView = jsonView;
+    }
+
+    public String getInclude() {
+        return include;
+    }
+
+    public void setInclude(String include) {
+        this.include = include;
+    }
+
+    public boolean isAllowJmsType() {
+        return allowJmsType;
+    }
+
+    public boolean isPrettyPrint() {
+        return prettyPrint;
+    }
+
+    public void setPrettyPrint(boolean prettyPrint) {
+        this.prettyPrint = prettyPrint;
+    }
+
+    public boolean isUseList() {
+        return useList;
+    }
+
+    public void setUseList(boolean useList) {
+        this.useList = useList;
+    }
+
+    public boolean isEnableJaxbAnnotationModule() {
+        return enableJaxbAnnotationModule;
+    }
+
+    public void setEnableJaxbAnnotationModule(boolean enableJaxbAnnotationModule) {
+        this.enableJaxbAnnotationModule = enableJaxbAnnotationModule;
+    }
+
+    public List<Module> getModules() {
+        return modules;
+    }
+
+    /**
+     * To use custom Jackson {@link Module}s
+     */
+    public void setModules(List<Module> modules) {
+        this.modules = modules;
+    }
+
+    public String getModuleClassNames() {
+        return moduleClassNames;
+    }
+
+    /**
+     * To use the custom Jackson module
+     */
+    public void addModule(Module module) {
+        if (this.modules == null) {
+            this.modules = new ArrayList<>();
+        }
+        this.modules.add(module);
+    }
+
+    /**
+     * To use custom Jackson {@link Module}s specified as a String with FQN
+     * class names. Multiple classes can be separated by comma.
+     */
+    public void setModuleClassNames(String moduleClassNames) {
+        this.moduleClassNames = moduleClassNames;
+    }
+
+    public String getModuleRefs() {
+        return moduleRefs;
+    }
+
+    /**
+     * To use custom Jackson modules referred from the Camel registry. Multiple
+     * modules can be separated by comma.
+     */
+    public void setModuleRefs(String moduleRefs) {
+        this.moduleRefs = moduleRefs;
+    }
+
+    /**
+     * Uses {@link java.util.ArrayList} when unmarshalling.
+     */
+    public void useList() {
+        setCollectionType(ArrayList.class);
+    }
+
+    /**
+     * Uses {@link java.util.HashMap} when unmarshalling.
+     */
+    public void useMap() {
+        setCollectionType(null);
+        setUnmarshalType(HashMap.class);
+    }
+
+    /**
+     * Allows jackson to use the <tt>JMSType</tt> header as an indicator what
+     * the classname is for unmarshaling json content to POJO
+     * <p/>
+     * By default this option is <tt>false</tt>.
+     */
+    public void setAllowJmsType(boolean allowJmsType) {
+        this.allowJmsType = allowJmsType;
+    }
+
+    public boolean isEnableJacksonTypeConverter() {
+        return enableJacksonTypeConverter;
+    }
+
+    /**
+     * If enabled then Jackson is allowed to attempt to be used during Camels
+     * <a href="https://camel.apache.org/type-converter.html">type converter</a>
+     * as a {@link org.apache.camel.FallbackConverter} that attempts to convert
+     * POJOs to/from {@link Map}/{@link List} types.
+     * <p/>
+     * This should only be enabled when desired to be used.
+     */
+    public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter) {
+        this.enableJacksonTypeConverter = enableJacksonTypeConverter;
+    }
+
+    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 setAllowUnmarshallType(boolean allowJacksonUnmarshallType) {
+        this.allowUnmarshallType = allowJacksonUnmarshallType;
+    }
+
+    public boolean isContentTypeHeader() {
+        return contentTypeHeader;
+    }
+
+    /**
+     * If enabled then Jackson will set the Content-Type header to
+     * <tt>application/json</tt> when marshalling.
+     */
+    public void setContentTypeHeader(boolean contentTypeHeader) {
+        this.contentTypeHeader = contentTypeHeader;
+    }
+
+    public TimeZone getTimezone() {
+        return timezone;
+    }
+
+    /**
+     * If set then Jackson will use the Timezone when marshalling/unmarshalling.
+     */
+    public void setTimezone(TimeZone timezone) {
+        this.timezone = timezone;
+    }
+
+    public boolean isAutoDiscoverObjectMapper() {
+        return autoDiscoverObjectMapper;
+    }
+
+    /**
+     * If set to true then Jackson will lookup for an objectMapper into the
+     * registry
+     */
+    public void setAutoDiscoverObjectMapper(boolean autoDiscoverObjectMapper) {
+        this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+    }
+
+    public String getEnableFeatures() {
+        return enableFeatures;
+    }
+
+    /**
+     * Set of features to enable on the Jackson {@link ObjectMapper}. The
+     * features should be a name that matches a enum from
+     * {@link SerializationFeature}, {@link DeserializationFeature}, or
+     * {@link MapperFeature}.
+     */
+    public void setEnableFeatures(String enableFeatures) {
+        this.enableFeatures = enableFeatures;
+    }
+
+    public String getDisableFeatures() {
+        return disableFeatures;
+    }
+
+    /**
+     * Set of features to disable on the Jackson {@link ObjectMapper}. The
+     * features should be a name that matches a enum from
+     * {@link SerializationFeature}, {@link DeserializationFeature}, or
+     * {@link MapperFeature}.
+     */
+    public void setDisableFeatures(String disableFeatures) {
+        this.disableFeatures = disableFeatures;
+    }
+
+    public void enableFeature(SerializationFeature feature) {
+        if (enableFeatures == null) {
+            enableFeatures = feature.name();
+        } else {
+            enableFeatures += "," + feature.name();
+        }
+    }
+
+    public void enableFeature(DeserializationFeature feature) {
+        if (enableFeatures == null) {
+            enableFeatures = feature.name();
+        } else {
+            enableFeatures += "," + feature.name();
+        }
+    }
+
+    public void enableFeature(MapperFeature feature) {
+        if (enableFeatures == null) {
+            enableFeatures = feature.name();
+        } else {
+            enableFeatures += "," + feature.name();
+        }
+    }
+
+    public void disableFeature(SerializationFeature feature) {
+        if (disableFeatures == null) {
+            disableFeatures = feature.name();
+        } else {
+            disableFeatures += "," + feature.name();
+        }
+    }
+
+    public void disableFeature(DeserializationFeature feature) {
+        if (disableFeatures == null) {
+            disableFeatures = feature.name();
+        } else {
+            disableFeatures += "," + feature.name();
+        }
+    }
+
+    public void disableFeature(MapperFeature feature) {
+        if (disableFeatures == null) {
+            disableFeatures = feature.name();
+        } else {
+            disableFeatures += "," + feature.name();
+        }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        boolean objectMapperFoundRegistry = false;
+        if (objectMapper == null) {
+            // lookup if there is a single default mapper we can use
+            if (useDefaultObjectMapper && camelContext != null) {
+                if (isAutoDiscoverObjectMapper()) {
+                    Set<ObjectMapper> set = camelContext.getRegistry().findByType(ObjectMapper.class);
+                    if (set.size() == 1) {
+                        objectMapper = set.iterator().next();
+                        log.info("Found single ObjectMapper in Registry to use: {}", objectMapper);
+                        objectMapperFoundRegistry = true;
+                    } else if (set.size() > 1) {
+                        log.debug("Found {} ObjectMapper in Registry cannot use as default as there are more than one instance.", set.size());
+                    }
+                } else {
+                    log.warn("The option autoDiscoverObjectMapper is set to false, Camel won't search in the registry");
+                }
+            }
+            if (objectMapper == null) {
+                objectMapper = new ObjectMapper();
+                log.debug("Creating new ObjectMapper to use: {}", objectMapper);
+            }
+        }
+
+        if (!objectMapperFoundRegistry) {
+            if (enableJaxbAnnotationModule) {
+                // Enables JAXB processing
+                JaxbAnnotationModule module = new JaxbAnnotationModule();
+                log.debug("Registering JaxbAnnotationModule: {}", module);
+                objectMapper.registerModule(module);
+            }
+
+            if (useList) {
+                setCollectionType(ArrayList.class);
+            }
+            if (include != null) {
+                JsonInclude.Include inc = getCamelContext().getTypeConverter().mandatoryConvertTo(JsonInclude.Include.class, include);
+                objectMapper.setSerializationInclusion(inc);
+            }
+            if (prettyPrint) {
+                objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
+            }
+
+            if (enableFeatures != null) {
+                Iterator<?> it = ObjectHelper.createIterator(enableFeatures);
+                while (it.hasNext()) {
+                    String enable = it.next().toString();
+                    // it can be different kind
+                    SerializationFeature sf = getCamelContext().getTypeConverter().tryConvertTo(SerializationFeature.class, enable);
+                    if (sf != null) {
+                        objectMapper.enable(sf);
+                        continue;
+                    }
+                    DeserializationFeature df = getCamelContext().getTypeConverter().tryConvertTo(DeserializationFeature.class, enable);
+                    if (df != null) {
+                        objectMapper.enable(df);
+                        continue;
+                    }
+                    MapperFeature mf = getCamelContext().getTypeConverter().tryConvertTo(MapperFeature.class, enable);
+                    if (mf != null) {
+                        objectMapper.enable(mf);
+                        continue;
+                    }
+                    throw new IllegalArgumentException("Enable feature: " + enable
+                                                       + " cannot be converted to an accepted enum of types [SerializationFeature,DeserializationFeature,MapperFeature]");
+                }
+            }
+            if (disableFeatures != null) {
+                Iterator<?> it = ObjectHelper.createIterator(disableFeatures);
+                while (it.hasNext()) {
+                    String disable = it.next().toString();
+                    // it can be different kind
+                    SerializationFeature sf = getCamelContext().getTypeConverter().tryConvertTo(SerializationFeature.class, disable);
+                    if (sf != null) {
+                        objectMapper.disable(sf);
+                        continue;
+                    }
+                    DeserializationFeature df = getCamelContext().getTypeConverter().tryConvertTo(DeserializationFeature.class, disable);
+                    if (df != null) {
+                        objectMapper.disable(df);
+                        continue;
+                    }
+                    MapperFeature mf = getCamelContext().getTypeConverter().tryConvertTo(MapperFeature.class, disable);
+                    if (mf != null) {
+                        objectMapper.disable(mf);
+                        continue;
+                    }
+                    throw new IllegalArgumentException("Disable feature: " + disable
+                                                       + " cannot be converted to an accepted enum of types [SerializationFeature,DeserializationFeature,MapperFeature]");
+                }
+            }
+
+            if (modules != null) {
+                for (Module module : modules) {
+                    log.debug("Registering module: {}", module);
+                    objectMapper.registerModules(module);
+                }
+            }
+            if (moduleClassNames != null) {
+                Iterable<?> it = ObjectHelper.createIterable(moduleClassNames);
+                for (Object o : it) {
+                    String name = o.toString();
+                    Class<Module> clazz = camelContext.getClassResolver().resolveMandatoryClass(name, Module.class);
+                    Module module = camelContext.getInjector().newInstance(clazz);
+                    log.debug("Registering module: {} -> {}", name, module);
+                    objectMapper.registerModule(module);
+                }
+            }
+            if (moduleRefs != null) {
+                Iterable<?> it = ObjectHelper.createIterable(moduleRefs);
+                for (Object o : it) {
+                    String name = o.toString();
+                    if (name.startsWith("#")) {
+                        name = name.substring(1);
+                    }
+                    Module module = CamelContextHelper.mandatoryLookup(camelContext, name, Module.class);
+                    log.debug("Registering module: {} -> {}", name, module);
+                    objectMapper.registerModule(module);
+                }
+            }
+            if (org.apache.camel.util.ObjectHelper.isNotEmpty(timezone)) {
+                log.debug("Setting timezone to Object Mapper: {}", timezone);
+                objectMapper.setTimeZone(timezone);
+            }
+        }
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        // noop
+    }
 
 }
diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/ListJacksonDataFormat.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/ListJacksonDataFormat.java
index 85bac9e..b3e015a 100644
--- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/ListJacksonDataFormat.java
+++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/ListJacksonDataFormat.java
@@ -19,7 +19,8 @@ package org.apache.camel.component.jackson;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 /**
- * A {@link org.apache.camel.component.jackson.JacksonDataFormat} that is using a list
+ * A {@link org.apache.camel.component.jackson.JacksonDataFormat} that is using
+ * a list
  */
 public class ListJacksonDataFormat extends JacksonDataFormat {
 
@@ -36,7 +37,7 @@ public class ListJacksonDataFormat extends JacksonDataFormat {
         super(unmarshalType, jsonView);
         useList();
     }
-    
+
     public ListJacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView, boolean enableJaxbAnnotationModule) {
         super(unmarshalType, jsonView, enableJaxbAnnotationModule);
         useList();
diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
index fe90ec5..f906d11 100644
--- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
+++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
@@ -31,16 +31,19 @@ import org.apache.camel.spi.Registry;
 import org.apache.camel.spi.TypeConverterRegistry;
 
 /**
- * Jackson {@link org.apache.camel.TypeConverter} that allows converting json to/from POJOs and other types.
- * <br/>
+ * Jackson {@link org.apache.camel.TypeConverter} that allows converting json
+ * to/from POJOs and other types. <br/>
  * This implementation uses a fallback converter.
  * <p/>
  * The converter is disabled by default. To enable then set the property
- * {@link JacksonConstants#ENABLE_TYPE_CONVERTER} to <tt>true</tt> on {@link CamelContext#getGlobalOptions()}.
- * <br/>
- * The option {@link JacksonConstants#TYPE_CONVERTER_TO_POJO} can be used to allow converting to POJO types. By
- * default the converter only attempts to convert to primitive types such as String and numbers. To convert to any kind, then
- * enable this by setting {@link JacksonConstants#TYPE_CONVERTER_TO_POJO} to <tt>true</tt> on {@link CamelContext#getGlobalOptions()}.
+ * {@link JacksonConstants#ENABLE_TYPE_CONVERTER} to <tt>true</tt> on
+ * {@link CamelContext#getGlobalOptions()}. <br/>
+ * The option {@link JacksonConstants#TYPE_CONVERTER_TO_POJO} can be used to
+ * allow converting to POJO types. By default the converter only attempts to
+ * convert to primitive types such as String and numbers. To convert to any
+ * kind, then enable this by setting
+ * {@link JacksonConstants#TYPE_CONVERTER_TO_POJO} to <tt>true</tt> on
+ * {@link CamelContext#getGlobalOptions()}.
  */
 @Converter(generateLoader = true)
 public final class JacksonTypeConverters {
@@ -52,7 +55,8 @@ public final class JacksonTypeConverters {
 
     public JacksonTypeConverters() {
         defaultMapper = new ObjectMapper();
-        // Enables JAXB processing so we can easily convert JAXB annotated pojos also
+        // Enables JAXB processing so we can easily convert JAXB annotated pojos
+        // also
         JaxbAnnotationModule module = new JaxbAnnotationModule();
         defaultMapper.registerModule(module);
     }
@@ -90,9 +94,11 @@ public final class JacksonTypeConverters {
         if (exchange != null) {
             ObjectMapper mapper = resolveObjectMapper(exchange.getContext().getRegistry());
 
-            // favor use write/read operations as they are higher level than the convertValue
+            // favor use write/read operations as they are higher level than the
+            // convertValue
 
-            // if we want to convert to a String or byte[] then use write operation
+            // if we want to convert to a String or byte[] then use write
+            // operation
             if (String.class.isAssignableFrom(type)) {
                 String out = mapper.writeValueAsString(value);
                 return type.cast(out);
@@ -100,17 +106,18 @@ public final class JacksonTypeConverters {
                 byte[] out = mapper.writeValueAsBytes(value);
                 return type.cast(out);
             } else if (mapper.canSerialize(type) && !Enum.class.isAssignableFrom(type)) {
-                // if the source value type is readable by the mapper then use its read operation
+                // if the source value type is readable by the mapper then use
+                // its read operation
                 if (String.class.isAssignableFrom(value.getClass())) {
-                    return mapper.readValue((String) value, type);
+                    return mapper.readValue((String)value, type);
                 } else if (byte[].class.isAssignableFrom(value.getClass())) {
-                    return mapper.readValue((byte[]) value, type);
+                    return mapper.readValue((byte[])value, type);
                 } else if (File.class.isAssignableFrom(value.getClass())) {
-                    return mapper.readValue((File) value, type);
+                    return mapper.readValue((File)value, type);
                 } else if (InputStream.class.isAssignableFrom(value.getClass())) {
-                    return mapper.readValue((InputStream) value, type);
+                    return mapper.readValue((InputStream)value, type);
                 } else if (Reader.class.isAssignableFrom(value.getClass())) {
-                    return mapper.readValue((Reader) value, type);
+                    return mapper.readValue((Reader)value, type);
                 } else {
                     // fallback to generic convert value
                     return mapper.convertValue(value, type);
@@ -123,14 +130,13 @@ public final class JacksonTypeConverters {
     }
 
     /**
-     * Whether the type is NOT a pojo type but only a set of simple types such as String and numbers.
+     * Whether the type is NOT a pojo type but only a set of simple types such
+     * as String and numbers.
      */
     private static boolean isNotPojoType(Class<?> type) {
         boolean isString = String.class.isAssignableFrom(type);
-        boolean isNumber = Number.class.isAssignableFrom(type)
-                || int.class.isAssignableFrom(type) || long.class.isAssignableFrom(type)
-                || short.class.isAssignableFrom(type) || char.class.isAssignableFrom(type)
-                || float.class.isAssignableFrom(type) || double.class.isAssignableFrom(type);
+        boolean isNumber = Number.class.isAssignableFrom(type) || int.class.isAssignableFrom(type) || long.class.isAssignableFrom(type) || short.class.isAssignableFrom(type)
+                           || char.class.isAssignableFrom(type) || float.class.isAssignableFrom(type) || double.class.isAssignableFrom(type);
         return isString || isNumber;
     }
 
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConcurrentTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConcurrentTest.java
index 0803c86..2e0124c 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConcurrentTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConcurrentTest.java
@@ -63,14 +63,9 @@ public class JacksonConcurrentTest extends CamelTestSupport {
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").
-                        marshal().json(JsonLibrary.Jackson).
-                        to("log:marshalled").
-                        to("direct:marshalled");
+                from("direct:start").marshal().json(JsonLibrary.Jackson).to("log:marshalled").to("direct:marshalled");
 
-                from("direct:marshalled").
-                        unmarshal().json(JsonLibrary.Jackson, TestPojo.class).
-                        to("mock:result");
+                from("direct:marshalled").unmarshal().json(JsonLibrary.Jackson, TestPojo.class).to("mock:result");
             }
         };
     }
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonDataFormatTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonDataFormatTest.java
index 7453c09..08af0d9 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonDataFormatTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonDataFormatTest.java
@@ -54,4 +54,4 @@ public class JacksonDataFormatTest {
 
         assertEquals(expected, unmarshalled);
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonJsonDataFormatTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonJsonDataFormatTest.java
index 92aae09..09af454 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonJsonDataFormatTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonJsonDataFormatTest.java
@@ -39,4 +39,4 @@ public class JacksonJsonDataFormatTest extends JacksonMarshalTest {
         };
     }
 
-}
\ No newline at end of file
+}
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalDateTimezoneTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalDateTimezoneTest.java
index 308e995..2805547 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalDateTimezoneTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalDateTimezoneTest.java
@@ -25,7 +25,6 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-
 public class JacksonMarshalDateTimezoneTest extends CamelTestSupport {
 
     @Test
@@ -38,7 +37,7 @@ public class JacksonMarshalDateTimezoneTest extends CamelTestSupport {
         Object marshalled = template.requestBody("direct:in", in.getTime());
         String marshalledAsString = context.getTypeConverter().convertTo(String.class, marshalled);
         assertEquals("1493139610000", marshalledAsString);
-        
+
         mock.expectedMessageCount(1);
 
         mock.assertIsSatisfied();
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalListTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalListTest.java
index 75deece..0544f45 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalListTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUnmarshalListTest.java
@@ -40,9 +40,9 @@ public class JacksonMarshalUnmarshalListTest extends CamelTestSupport {
         assertNotNull(list);
         assertEquals(2, list.size());
 
-        TestPojo pojo = (TestPojo) list.get(0);
+        TestPojo pojo = (TestPojo)list.get(0);
         assertEquals("Camel", pojo.getName());
-        pojo = (TestPojo) list.get(1);
+        pojo = (TestPojo)list.get(1);
         assertEquals("World", pojo.getName());
     }
 
@@ -61,7 +61,7 @@ public class JacksonMarshalUnmarshalListTest extends CamelTestSupport {
         assertNotNull(list);
         assertEquals(1, list.size());
 
-        TestPojo pojo = (TestPojo) list.get(0);
+        TestPojo pojo = (TestPojo)list.get(0);
         assertEquals("Camel", pojo.getName());
     }
 
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonNotUseDefaultObjectMapperTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonNotUseDefaultObjectMapperTest.java
index 771c0df..d7fc992 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonNotUseDefaultObjectMapperTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonNotUseDefaultObjectMapperTest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package org.apache.camel.component.jackson;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -30,7 +31,7 @@ import org.junit.Test;
 public class JacksonNotUseDefaultObjectMapperTest extends CamelTestSupport {
 
     private JacksonDataFormat df = new JacksonDataFormat();
-    
+
     @BindToRegistry("myMapper")
     private ObjectMapper objectMapper = new ObjectMapper();
 
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectListSplitTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectListSplitTest.java
index a558863..fbb4e9a 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectListSplitTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectListSplitTest.java
@@ -36,14 +36,15 @@ public class JacksonObjectListSplitTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                // you can specify the pojo class type for unmarshal the jason file
+                // you can specify the pojo class type for unmarshal the jason
+                // file
                 JacksonDataFormat format = new JacksonDataFormat(DummyObject.class);
                 format.useList();
                 from("direct:start").unmarshal(format).split(body()).to("mock:result");
             }
         };
     }
-    
+
     public static class DummyObject {
 
         private String dummy;
@@ -60,4 +61,4 @@ public class JacksonObjectListSplitTest extends CamelTestSupport {
         }
     }
 
-}
\ No newline at end of file
+}
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectMapperRegistryTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectMapperRegistryTest.java
index fc106ba..d25521f 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectMapperRegistryTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectMapperRegistryTest.java
@@ -32,7 +32,7 @@ import org.junit.Test;
 public class JacksonObjectMapperRegistryTest extends CamelTestSupport {
 
     private JacksonDataFormat df;
-   
+
     @BindToRegistry("myMapper")
     private ObjectMapper objectMapper = new ObjectMapper();
 
@@ -62,9 +62,9 @@ public class JacksonObjectMapperRegistryTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-            	df = new JacksonDataFormat();
-            	df.setAutoDiscoverObjectMapper(true);
-            	
+                df = new JacksonDataFormat();
+                df.setAutoDiscoverObjectMapper(true);
+
                 from("direct:in").marshal(df);
                 from("direct:back").unmarshal(df).to("mock:reverse");
             }
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/SpringJacksonMarshalUnmarshalListTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/SpringJacksonMarshalUnmarshalListTest.java
index 9586439..7923907 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/SpringJacksonMarshalUnmarshalListTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/SpringJacksonMarshalUnmarshalListTest.java
@@ -41,9 +41,9 @@ public class SpringJacksonMarshalUnmarshalListTest extends CamelSpringTestSuppor
         assertNotNull(list);
         assertEquals(2, list.size());
 
-        TestPojo pojo = (TestPojo) list.get(0);
+        TestPojo pojo = (TestPojo)list.get(0);
         assertEquals("Camel", pojo.getName());
-        pojo = (TestPojo) list.get(1);
+        pojo = (TestPojo)list.get(1);
         assertEquals("World", pojo.getName());
     }
 
@@ -62,7 +62,7 @@ public class SpringJacksonMarshalUnmarshalListTest extends CamelSpringTestSuppor
         assertNotNull(list);
         assertEquals(1, list.size());
 
-        TestPojo pojo = (TestPojo) list.get(0);
+        TestPojo pojo = (TestPojo)list.get(0);
         assertEquals("Camel", pojo.getName());
     }
 
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/SpringJacksonObjectMapperRegistryTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/SpringJacksonObjectMapperRegistryTest.java
index bf22c7d..62dd876 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/SpringJacksonObjectMapperRegistryTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/SpringJacksonObjectMapperRegistryTest.java
@@ -51,10 +51,10 @@ public class SpringJacksonObjectMapperRegistryTest extends CamelSpringTestSuppor
 
         mock.assertIsSatisfied();
 
-        MyJsonObjectMapper mapper = (MyJsonObjectMapper) context.getRegistry().lookupByName("myJsonObjectMapper");
+        MyJsonObjectMapper mapper = (MyJsonObjectMapper)context.getRegistry().lookupByName("myJsonObjectMapper");
         assertNotNull(mapper);
 
-        JacksonDataFormat df = (JacksonDataFormat) DataFormatReifier.getDataFormat(context, null, "jack");
+        JacksonDataFormat df = (JacksonDataFormat)DataFormatReifier.getDataFormat(context, null, "jack");
         assertNotNull(df);
         assertSame(mapper, df.getObjectMapper());
     }
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestJAXBPojo.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestJAXBPojo.java
index b9d7b14..a8867da 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestJAXBPojo.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestJAXBPojo.java
@@ -35,7 +35,7 @@ public class TestJAXBPojo {
 
     @Override
     public boolean equals(Object obj) {
-        return this.name.equals(((TestJAXBPojo) obj).getName());
+        return this.name.equals(((TestJAXBPojo)obj).getName());
     }
 
     @Override
@@ -47,4 +47,4 @@ public class TestJAXBPojo {
     public String toString() {
         return "TestJAXBPojo[" + name + "]";
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestOtherPojo.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestOtherPojo.java
index 7f66153..d2d43e3 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestOtherPojo.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestOtherPojo.java
@@ -37,4 +37,4 @@ public class TestOtherPojo {
         this.country = country;
     }
 
-}
\ No newline at end of file
+}
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojo.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojo.java
index 6382bf7..ba47dce 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojo.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojo.java
@@ -30,7 +30,7 @@ public class TestPojo {
 
     @Override
     public boolean equals(Object obj) {
-        return this.name.equals(((TestPojo) obj).getName());
+        return this.name.equals(((TestPojo)obj).getName());
     }
 
     @Override
@@ -42,4 +42,4 @@ public class TestPojo {
     public String toString() {
         return "TestPojo[" + name + "]";
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojoView.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojoView.java
index 7fb775d..dc6191d 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojoView.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojoView.java
@@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonView;
 
 public class TestPojoView {
 
-    //START SNIPPET: jsonview
+    // START SNIPPET: jsonview
     @JsonView(Views.Age.class)
     private int age = 30;
 
@@ -28,7 +28,7 @@ public class TestPojoView {
 
     @JsonView(Views.Weight.class)
     private int weight = 70;
-    //END SNIPPET: jsonview
+    // END SNIPPET: jsonview
 
     public int getAge() {
         return age;
@@ -63,7 +63,7 @@ public class TestPojoView {
             return false;
         }
 
-        TestPojoView that = (TestPojoView) o;
+        TestPojoView that = (TestPojoView)o;
 
         if (age != that.age) {
             return false;
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/Views.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/Views.java
index dcb3387..4c238ac 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/Views.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/Views.java
@@ -19,7 +19,10 @@ package org.apache.camel.component.jackson;
 //START SNIPPET: marker
 public class Views {
 
-    static class Age { }
-    static class Weight { }
+    static class Age {
+    }
+
+    static class Weight {
+    }
 }
 //END SNIPPET: marker
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsPojoTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsPojoTest.java
index cbcef4a..84e1a29 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsPojoTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsPojoTest.java
@@ -27,7 +27,8 @@ public class JacksonConversionsPojoTest extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext context = super.createCamelContext();
-        // enable jackson type converter by setting this property on CamelContext
+        // enable jackson type converter by setting this property on
+        // CamelContext
         context.getGlobalOptions().put(JacksonConstants.ENABLE_TYPE_CONVERTER, "true");
         context.getGlobalOptions().put(JacksonConstants.TYPE_CONVERTER_TO_POJO, "true");
         return context;
@@ -40,7 +41,7 @@ public class JacksonConversionsPojoTest extends CamelTestSupport {
         order.setCustomerName("Acme");
         order.setPartName("Camel");
 
-        String json = (String) template.requestBody("direct:test", order);
+        String json = (String)template.requestBody("direct:test", order);
         assertEquals("{\"id\":0,\"partName\":\"Camel\",\"amount\":1,\"customerName\":\"Acme\"}", json);
     }
 
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsSimpleTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsSimpleTest.java
index 219eb8e..a182099 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsSimpleTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsSimpleTest.java
@@ -37,7 +37,8 @@ public class JacksonConversionsSimpleTest extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext context = super.createCamelContext();
-        // enable jackson type converter by setting this property on CamelContext
+        // enable jackson type converter by setting this property on
+        // CamelContext
         context.getGlobalOptions().put(JacksonConstants.ENABLE_TYPE_CONVERTER, "true");
         return context;
     }
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsTest.java
index f141c2e..3271b17 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/converter/JacksonConversionsTest.java
@@ -31,7 +31,8 @@ public class JacksonConversionsTest extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext context = super.createCamelContext();
-        // enable jackson type converter by setting this property on CamelContext
+        // enable jackson type converter by setting this property on
+        // CamelContext
         context.getGlobalOptions().put(JacksonConstants.ENABLE_TYPE_CONVERTER, "true");
         return context;
     }
@@ -42,7 +43,7 @@ public class JacksonConversionsTest extends CamelTestSupport {
         Map<String, String> pojoAsMap = new HashMap<>();
         pojoAsMap.put("name", name);
 
-        TestPojo testPojo = (TestPojo) template.requestBody("direct:test", pojoAsMap);
+        TestPojo testPojo = (TestPojo)template.requestBody("direct:test", pojoAsMap);
 
         assertEquals(name, testPojo.getName());
     }


[camel] 04/07: CAMEL-14101 - Regen

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 681ed3520b0eb38b47840cc26396e71adce6406d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 30 09:24:25 2019 +0100

    CAMEL-14101 - Regen
---
 components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc b/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
index 5c3c52c..3734315 100644
--- a/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
+++ b/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
@@ -53,7 +53,7 @@ The JSon XStream dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END


[camel] 06/07: CAMEL-14101 - Fixed CS in camel-core-engine

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 61ac81ae708aa432834b231f5f986e965273bf8d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 30 09:24:37 2019 +0100

    CAMEL-14101 - Fixed CS in camel-core-engine
---
 .../camel/model/dataformat/JsonDataFormat.java     | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index 06f350f..69e36e9 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -78,8 +78,7 @@ public class JsonDataFormat extends DataFormatDefinition {
     private String timezone;
     @XmlAttribute
     @Metadata(defaultValue = "false")
-	private Boolean autoDiscoverObjectMapper;    
-    
+    private Boolean autoDiscoverObjectMapper;
 
     public JsonDataFormat() {
         super("json");
@@ -369,17 +368,18 @@ public class JsonDataFormat extends DataFormatDefinition {
     public void setTimezone(String timezone) {
         this.timezone = timezone;
     }
-    
-	public Boolean isAutoDiscoverObjectMapper() {
-		return autoDiscoverObjectMapper;
-	}
-
-	/**
-	 * If set to true then Jackson will lookup for an objectMapper into the registry
-	 */
-	public void setAutoDiscoverObjectMapper(Boolean autoDiscoverObjectMapper) {
-		this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
-	}
+
+    public Boolean isAutoDiscoverObjectMapper() {
+        return autoDiscoverObjectMapper;
+    }
+
+    /**
+     * If set to true then Jackson will lookup for an objectMapper into the
+     * registry
+     */
+    public void setAutoDiscoverObjectMapper(Boolean autoDiscoverObjectMapper) {
+        this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+    }
 
     @Override
     public String getDataFormatName() {


[camel] 01/07: CAMEL-14101 - json-jackson dataformat: potential ObjectMapper configuration clashes

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 18aa63482affa009015de0644f5250380810cc02
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Oct 29 14:42:46 2019 +0100

    CAMEL-14101 - json-jackson dataformat: potential ObjectMapper configuration clashes
---
 .../camel/component/jackson/JacksonDataFormat.java | 1116 ++++++++++----------
 .../jackson/JacksonObjectMapperRegistryTest.java   |    7 +-
 .../camel/model/dataformat/JsonDataFormat.java     |   14 +
 3 files changed, 590 insertions(+), 547 deletions(-)

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 c412c90..c205e3b 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
@@ -53,551 +53,575 @@ import org.apache.camel.support.service.ServiceSupport;
 @Dataformat("json-jackson")
 public class JacksonDataFormat extends ServiceSupport implements DataFormat, DataFormatName, CamelContextAware {
 
-    private CamelContext camelContext;
-    private ObjectMapper objectMapper;
-    private boolean useDefaultObjectMapper = true;
-    private Class<? extends Collection> collectionType;
-    private List<Module> modules;
-    private String moduleClassNames;
-    private String moduleRefs;
-    private Class<?> unmarshalType;
-    private Class<?> jsonView;
-    private String include;
-    private boolean prettyPrint;
-    private boolean allowJmsType;
-    private boolean useList;
-    private boolean enableJaxbAnnotationModule;
-    private String enableFeatures;
-    private String disableFeatures;
-    private boolean enableJacksonTypeConverter;
-    private boolean allowUnmarshallType;
-    private boolean contentTypeHeader = true;
-    private TimeZone timezone;
-
-    /**
-     * Use the default Jackson {@link ObjectMapper} and {@link Object}
-     */
-    public JacksonDataFormat() {
-        this(Object.class);
-    }
-
-    /**
-     * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal
-     * type
-     *
-     * @param unmarshalType the custom unmarshal type
-     */
-    public JacksonDataFormat(Class<?> unmarshalType) {
-        this(unmarshalType, null);
-    }
-
-    /**
-     * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal
-     * type and JSON view
-     *
-     * @param unmarshalType the custom unmarshal type
-     * @param jsonView marker class to specify properties to be included during
-     *            marshalling. See also
-     *            http://wiki.fasterxml.com/JacksonJsonViews
-     */
-    public JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView) {
-        this(unmarshalType, jsonView, true);
-    }
-
-    /**
-     * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal
-     * type and JSON view
-     *
-     * @param unmarshalType the custom unmarshal type
-     * @param jsonView marker class to specify properties to be included during
-     *            marshalling. See also
-     *            http://wiki.fasterxml.com/JacksonJsonViews
-     * @param enableJaxbAnnotationModule if it is true, will enable the
-     *            JaxbAnnotationModule.
-     */
-    public JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView, boolean enableJaxbAnnotationModule) {
-        this.unmarshalType = unmarshalType;
-        this.jsonView = jsonView;
-        this.enableJaxbAnnotationModule = enableJaxbAnnotationModule;
-    }
-
-    /**
-     * Use a custom Jackson mapper and and unmarshal type
-     *
-     * @param mapper the custom mapper
-     * @param unmarshalType the custom unmarshal type
-     */
-    public JacksonDataFormat(ObjectMapper mapper, Class<?> unmarshalType) {
-        this(mapper, unmarshalType, null);
-    }
-
-    /**
-     * Use a custom Jackson mapper, unmarshal type and JSON view
-     *
-     * @param mapper the custom mapper
-     * @param unmarshalType the custom unmarshal type
-     * @param jsonView marker class to specify properties to be included during
-     *            marshalling. See also
-     *            http://wiki.fasterxml.com/JacksonJsonViews
-     */
-    public JacksonDataFormat(ObjectMapper mapper, Class<?> unmarshalType, Class<?> jsonView) {
-        this.objectMapper = mapper;
-        this.unmarshalType = unmarshalType;
-        this.jsonView = jsonView;
-    }
-
-    @Override
-    public String getDataFormatName() {
-        return "json-jackson";
-    }
-
-    @Override
-    public CamelContext getCamelContext() {
-        return camelContext;
-    }
-
-    @Override
-    public void setCamelContext(CamelContext camelContext) {
-        this.camelContext = camelContext;
-    }
-
-    @Override
-    public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
-        this.objectMapper.writerWithView(jsonView).writeValue(stream, graph);
-
-        if (contentTypeHeader) {
-            if (exchange.hasOut()) {
-                exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/json");
-            } else {
-                exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json");
-            }
-        }
-    }
-
-    @Override
-    public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
-
-        // is there a header with the unmarshal type?
-        Class<?> clazz = unmarshalType;
-        String type = null;
-        if (allowUnmarshallType) {
-            type = exchange.getIn().getHeader(JacksonConstants.UNMARSHAL_TYPE, String.class);
-        }
-        if (type == null && isAllowJmsType()) {
-            type = exchange.getIn().getHeader("JMSType", String.class);
-        }
-        if (type != null) {
-            clazz = exchange.getContext().getClassResolver().resolveMandatoryClass(type);
-        }
-        if (collectionType != null) {
-            CollectionType collType = objectMapper.getTypeFactory().constructCollectionType(collectionType, clazz);
-            return this.objectMapper.readValue(stream, collType);
-        } else {
-            return this.objectMapper.readValue(stream, clazz);
-        }
-    }
-
-    // Properties
-    // -------------------------------------------------------------------------
-
-    public ObjectMapper getObjectMapper() {
-        return this.objectMapper;
-    }
-
-    public void setObjectMapper(ObjectMapper objectMapper) {
-        this.objectMapper = objectMapper;
-    }
-
-    public boolean isUseDefaultObjectMapper() {
-        return useDefaultObjectMapper;
-    }
-
-    public void setUseDefaultObjectMapper(boolean useDefaultObjectMapper) {
-        this.useDefaultObjectMapper = useDefaultObjectMapper;
-    }
-
-    public Class<?> getUnmarshalType() {
-        return this.unmarshalType;
-    }
-
-    public void setUnmarshalType(Class<?> unmarshalType) {
-        this.unmarshalType = unmarshalType;
-    }
-
-    public Class<? extends Collection> getCollectionType() {
-        return collectionType;
-    }
-
-    public void setCollectionType(Class<? extends Collection> collectionType) {
-        this.collectionType = collectionType;
-    }
-
-    public Class<?> getJsonView() {
-        return jsonView;
-    }
-
-    public void setJsonView(Class<?> jsonView) {
-        this.jsonView = jsonView;
-    }
-
-    public String getInclude() {
-        return include;
-    }
-
-    public void setInclude(String include) {
-        this.include = include;
-    }
-
-    public boolean isAllowJmsType() {
-        return allowJmsType;
-    }
-
-    public boolean isPrettyPrint() {
-        return prettyPrint;
-    }
-
-    public void setPrettyPrint(boolean prettyPrint) {
-        this.prettyPrint = prettyPrint;
-    }
-
-    public boolean isUseList() {
-        return useList;
-    }
-
-    public void setUseList(boolean useList) {
-        this.useList = useList;
-    }
-
-    public boolean isEnableJaxbAnnotationModule() {
-        return enableJaxbAnnotationModule;
-    }
-
-    public void setEnableJaxbAnnotationModule(boolean enableJaxbAnnotationModule) {
-        this.enableJaxbAnnotationModule = enableJaxbAnnotationModule;
-    }
-
-    public List<Module> getModules() {
-        return modules;
-    }
-
-    /**
-     * To use custom Jackson {@link Module}s
-     */
-    public void setModules(List<Module> modules) {
-        this.modules = modules;
-    }
-
-    public String getModuleClassNames() {
-        return moduleClassNames;
-    }
-
-    /**
-     * To use the custom Jackson module
-     */
-    public void addModule(Module module) {
-        if (this.modules == null) {
-            this.modules = new ArrayList<>();
-        }
-        this.modules.add(module);
-    }
-
-    /**
-     * To use custom Jackson {@link Module}s specified as a String with FQN
-     * class names. Multiple classes can be separated by comma.
-     */
-    public void setModuleClassNames(String moduleClassNames) {
-        this.moduleClassNames = moduleClassNames;
-    }
-
-    public String getModuleRefs() {
-        return moduleRefs;
-    }
-
-    /**
-     * To use custom Jackson modules referred from the Camel registry. Multiple
-     * modules can be separated by comma.
-     */
-    public void setModuleRefs(String moduleRefs) {
-        this.moduleRefs = moduleRefs;
-    }
-
-    /**
-     * Uses {@link java.util.ArrayList} when unmarshalling.
-     */
-    public void useList() {
-        setCollectionType(ArrayList.class);
-    }
-
-    /**
-     * Uses {@link java.util.HashMap} when unmarshalling.
-     */
-    public void useMap() {
-        setCollectionType(null);
-        setUnmarshalType(HashMap.class);
-    }
-
-    /**
-     * Allows jackson to use the <tt>JMSType</tt> header as an indicator what
-     * the classname is for unmarshaling json content to POJO
-     * <p/>
-     * By default this option is <tt>false</tt>.
-     */
-    public void setAllowJmsType(boolean allowJmsType) {
-        this.allowJmsType = allowJmsType;
-    }
-
-    public boolean isEnableJacksonTypeConverter() {
-        return enableJacksonTypeConverter;
-    }
-
-    /**
-     * If enabled then Jackson is allowed to attempt to be used during Camels
-     * <a href="https://camel.apache.org/type-converter.html">type converter</a>
-     * as a {@link org.apache.camel.FallbackConverter} that attempts to convert
-     * POJOs to/from {@link Map}/{@link List} types.
-     * <p/>
-     * This should only be enabled when desired to be used.
-     */
-    public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter) {
-        this.enableJacksonTypeConverter = enableJacksonTypeConverter;
-    }
-
-    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 setAllowUnmarshallType(boolean allowJacksonUnmarshallType) {
-        this.allowUnmarshallType = allowJacksonUnmarshallType;
-    }
-
-    public boolean isContentTypeHeader() {
-        return contentTypeHeader;
-    }
-
-    /**
-     * If enabled then Jackson will set the Content-Type header to
-     * <tt>application/json</tt> when marshalling.
-     */
-    public void setContentTypeHeader(boolean contentTypeHeader) {
-        this.contentTypeHeader = contentTypeHeader;
-    }
-
-    public TimeZone getTimezone() {
-        return timezone;
-    }
-
-    /**
-     * If set then Jackson will use the Timezone when marshalling/unmarshalling.
-     */
-    public void setTimezone(TimeZone timezone) {
-        this.timezone = timezone;
-    }
-
-    public String getEnableFeatures() {
-        return enableFeatures;
-    }
-
-    /**
-     * Set of features to enable on the Jackson {@link ObjectMapper}. The
-     * features should be a name that matches a enum from
-     * {@link SerializationFeature}, {@link DeserializationFeature}, or
-     * {@link MapperFeature}.
-     */
-    public void setEnableFeatures(String enableFeatures) {
-        this.enableFeatures = enableFeatures;
-    }
-
-    public String getDisableFeatures() {
-        return disableFeatures;
-    }
-
-    /**
-     * Set of features to disable on the Jackson {@link ObjectMapper}. The
-     * features should be a name that matches a enum from
-     * {@link SerializationFeature}, {@link DeserializationFeature}, or
-     * {@link MapperFeature}.
-     */
-    public void setDisableFeatures(String disableFeatures) {
-        this.disableFeatures = disableFeatures;
-    }
-
-    public void enableFeature(SerializationFeature feature) {
-        if (enableFeatures == null) {
-            enableFeatures = feature.name();
-        } else {
-            enableFeatures += "," + feature.name();
-        }
-    }
-
-    public void enableFeature(DeserializationFeature feature) {
-        if (enableFeatures == null) {
-            enableFeatures = feature.name();
-        } else {
-            enableFeatures += "," + feature.name();
-        }
-    }
-
-    public void enableFeature(MapperFeature feature) {
-        if (enableFeatures == null) {
-            enableFeatures = feature.name();
-        } else {
-            enableFeatures += "," + feature.name();
-        }
-    }
-
-    public void disableFeature(SerializationFeature feature) {
-        if (disableFeatures == null) {
-            disableFeatures = feature.name();
-        } else {
-            disableFeatures += "," + feature.name();
-        }
-    }
-
-    public void disableFeature(DeserializationFeature feature) {
-        if (disableFeatures == null) {
-            disableFeatures = feature.name();
-        } else {
-            disableFeatures += "," + feature.name();
-        }
-    }
-
-    public void disableFeature(MapperFeature feature) {
-        if (disableFeatures == null) {
-            disableFeatures = feature.name();
-        } else {
-            disableFeatures += "," + feature.name();
-        }
-    }
-
-    @Override
-    protected void doStart() throws Exception {
-        if (objectMapper == null) {
-            // lookup if there is a single default mapper we can use
-            if (useDefaultObjectMapper && camelContext != null) {
-                Set<ObjectMapper> set = camelContext.getRegistry().findByType(ObjectMapper.class);
-                if (set.size() == 1) {
-                    objectMapper = set.iterator().next();
-                    log.info("Found single ObjectMapper in Registry to use: {}", objectMapper);
-                } else if (set.size() > 1) {
-                    log.debug("Found {} ObjectMapper in Registry cannot use as default as there are more than one instance.", set.size());
-                }
-            }
-            if (objectMapper == null) {
-                objectMapper = new ObjectMapper();
-                log.debug("Creating new ObjectMapper to use: {}", objectMapper);
-            }
-        }
-
-        if (enableJaxbAnnotationModule) {
-            // Enables JAXB processing
-            JaxbAnnotationModule module = new JaxbAnnotationModule();
-            log.debug("Registering JaxbAnnotationModule: {}", module);
-            objectMapper.registerModule(module);
-        }
-
-        if (useList) {
-            setCollectionType(ArrayList.class);
-        }
-        if (include != null) {
-            JsonInclude.Include inc = getCamelContext().getTypeConverter().mandatoryConvertTo(JsonInclude.Include.class, include);
-            objectMapper.setSerializationInclusion(inc);
-        }
-        if (prettyPrint) {
-            objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
-        }
-
-        if (enableFeatures != null) {
-            Iterator<?> it = ObjectHelper.createIterator(enableFeatures);
-            while (it.hasNext()) {
-                String enable = it.next().toString();
-                // it can be different kind
-                SerializationFeature sf = getCamelContext().getTypeConverter().tryConvertTo(SerializationFeature.class, enable);
-                if (sf != null) {
-                    objectMapper.enable(sf);
-                    continue;
-                }
-                DeserializationFeature df = getCamelContext().getTypeConverter().tryConvertTo(DeserializationFeature.class, enable);
-                if (df != null) {
-                    objectMapper.enable(df);
-                    continue;
-                }
-                MapperFeature mf = getCamelContext().getTypeConverter().tryConvertTo(MapperFeature.class, enable);
-                if (mf != null) {
-                    objectMapper.enable(mf);
-                    continue;
-                }
-                throw new IllegalArgumentException("Enable feature: " + enable
-                                                   + " cannot be converted to an accepted enum of types [SerializationFeature,DeserializationFeature,MapperFeature]");
-            }
-        }
-        if (disableFeatures != null) {
-            Iterator<?> it = ObjectHelper.createIterator(disableFeatures);
-            while (it.hasNext()) {
-                String disable = it.next().toString();
-                // it can be different kind
-                SerializationFeature sf = getCamelContext().getTypeConverter().tryConvertTo(SerializationFeature.class, disable);
-                if (sf != null) {
-                    objectMapper.disable(sf);
-                    continue;
-                }
-                DeserializationFeature df = getCamelContext().getTypeConverter().tryConvertTo(DeserializationFeature.class, disable);
-                if (df != null) {
-                    objectMapper.disable(df);
-                    continue;
-                }
-                MapperFeature mf = getCamelContext().getTypeConverter().tryConvertTo(MapperFeature.class, disable);
-                if (mf != null) {
-                    objectMapper.disable(mf);
-                    continue;
-                }
-                throw new IllegalArgumentException("Disable feature: " + disable
-                                                   + " cannot be converted to an accepted enum of types [SerializationFeature,DeserializationFeature,MapperFeature]");
-            }
-        }
-
-        if (modules != null) {
-            for (Module module : modules) {
-                log.debug("Registering module: {}", module);
-                objectMapper.registerModules(module);
-            }
-        }
-        if (moduleClassNames != null) {
-            Iterable<?> it = ObjectHelper.createIterable(moduleClassNames);
-            for (Object o : it) {
-                String name = o.toString();
-                Class<Module> clazz = camelContext.getClassResolver().resolveMandatoryClass(name, Module.class);
-                Module module = camelContext.getInjector().newInstance(clazz);
-                log.debug("Registering module: {} -> {}", name, module);
-                objectMapper.registerModule(module);
-            }
-        }
-        if (moduleRefs != null) {
-            Iterable<?> it = ObjectHelper.createIterable(moduleRefs);
-            for (Object o : it) {
-                String name = o.toString();
-                if (name.startsWith("#")) {
-                    name = name.substring(1);
-                }
-                Module module = CamelContextHelper.mandatoryLookup(camelContext, name, Module.class);
-                log.debug("Registering module: {} -> {}", name, module);
-                objectMapper.registerModule(module);
-            }
-        }
-        if (org.apache.camel.util.ObjectHelper.isNotEmpty(timezone)) {
-            log.debug("Setting timezone to Object Mapper: {}", timezone);
-            objectMapper.setTimeZone(timezone);
-        }
-    }
-
-    @Override
-    protected void doStop() throws Exception {
-        // noop
-    }
+	private CamelContext camelContext;
+	private ObjectMapper objectMapper;
+	private boolean useDefaultObjectMapper = true;
+	private Class<? extends Collection> collectionType;
+	private List<Module> modules;
+	private String moduleClassNames;
+	private String moduleRefs;
+	private Class<?> unmarshalType;
+	private Class<?> jsonView;
+	private String include;
+	private boolean prettyPrint;
+	private boolean allowJmsType;
+	private boolean useList;
+	private boolean enableJaxbAnnotationModule;
+	private String enableFeatures;
+	private String disableFeatures;
+	private boolean enableJacksonTypeConverter;
+	private boolean allowUnmarshallType;
+	private boolean contentTypeHeader = true;
+	private TimeZone timezone;
+	private boolean autoDiscoverObjectMapper;
+
+	/**
+	 * Use the default Jackson {@link ObjectMapper} and {@link Object}
+	 */
+	public JacksonDataFormat() {
+		this(Object.class);
+	}
+
+	/**
+	 * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal type
+	 *
+	 * @param unmarshalType the custom unmarshal type
+	 */
+	public JacksonDataFormat(Class<?> unmarshalType) {
+		this(unmarshalType, null);
+	}
+
+	/**
+	 * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal type
+	 * and JSON view
+	 *
+	 * @param unmarshalType the custom unmarshal type
+	 * @param jsonView      marker class to specify properties to be included during
+	 *                      marshalling. See also
+	 *                      http://wiki.fasterxml.com/JacksonJsonViews
+	 */
+	public JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView) {
+		this(unmarshalType, jsonView, true);
+	}
+
+	/**
+	 * Use the default Jackson {@link ObjectMapper} and with a custom unmarshal type
+	 * and JSON view
+	 *
+	 * @param unmarshalType              the custom unmarshal type
+	 * @param jsonView                   marker class to specify properties to be
+	 *                                   included during marshalling. See also
+	 *                                   http://wiki.fasterxml.com/JacksonJsonViews
+	 * @param enableJaxbAnnotationModule if it is true, will enable the
+	 *                                   JaxbAnnotationModule.
+	 */
+	public JacksonDataFormat(Class<?> unmarshalType, Class<?> jsonView, boolean enableJaxbAnnotationModule) {
+		this.unmarshalType = unmarshalType;
+		this.jsonView = jsonView;
+		this.enableJaxbAnnotationModule = enableJaxbAnnotationModule;
+	}
+
+	/**
+	 * Use a custom Jackson mapper and and unmarshal type
+	 *
+	 * @param mapper        the custom mapper
+	 * @param unmarshalType the custom unmarshal type
+	 */
+	public JacksonDataFormat(ObjectMapper mapper, Class<?> unmarshalType) {
+		this(mapper, unmarshalType, null);
+	}
+
+	/**
+	 * Use a custom Jackson mapper, unmarshal type and JSON view
+	 *
+	 * @param mapper        the custom mapper
+	 * @param unmarshalType the custom unmarshal type
+	 * @param jsonView      marker class to specify properties to be included during
+	 *                      marshalling. See also
+	 *                      http://wiki.fasterxml.com/JacksonJsonViews
+	 */
+	public JacksonDataFormat(ObjectMapper mapper, Class<?> unmarshalType, Class<?> jsonView) {
+		this.objectMapper = mapper;
+		this.unmarshalType = unmarshalType;
+		this.jsonView = jsonView;
+	}
+
+	@Override
+	public String getDataFormatName() {
+		return "json-jackson";
+	}
+
+	@Override
+	public CamelContext getCamelContext() {
+		return camelContext;
+	}
+
+	@Override
+	public void setCamelContext(CamelContext camelContext) {
+		this.camelContext = camelContext;
+	}
+
+	@Override
+	public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
+		this.objectMapper.writerWithView(jsonView).writeValue(stream, graph);
+
+		if (contentTypeHeader) {
+			if (exchange.hasOut()) {
+				exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/json");
+			} else {
+				exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json");
+			}
+		}
+	}
+
+	@Override
+	public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+
+		// is there a header with the unmarshal type?
+		Class<?> clazz = unmarshalType;
+		String type = null;
+		if (allowUnmarshallType) {
+			type = exchange.getIn().getHeader(JacksonConstants.UNMARSHAL_TYPE, String.class);
+		}
+		if (type == null && isAllowJmsType()) {
+			type = exchange.getIn().getHeader("JMSType", String.class);
+		}
+		if (type != null) {
+			clazz = exchange.getContext().getClassResolver().resolveMandatoryClass(type);
+		}
+		if (collectionType != null) {
+			CollectionType collType = objectMapper.getTypeFactory().constructCollectionType(collectionType, clazz);
+			return this.objectMapper.readValue(stream, collType);
+		} else {
+			return this.objectMapper.readValue(stream, clazz);
+		}
+	}
+
+	// Properties
+	// -------------------------------------------------------------------------
+
+	public ObjectMapper getObjectMapper() {
+		return this.objectMapper;
+	}
+
+	public void setObjectMapper(ObjectMapper objectMapper) {
+		this.objectMapper = objectMapper;
+	}
+
+	public boolean isUseDefaultObjectMapper() {
+		return useDefaultObjectMapper;
+	}
+
+	public void setUseDefaultObjectMapper(boolean useDefaultObjectMapper) {
+		this.useDefaultObjectMapper = useDefaultObjectMapper;
+	}
+
+	public Class<?> getUnmarshalType() {
+		return this.unmarshalType;
+	}
+
+	public void setUnmarshalType(Class<?> unmarshalType) {
+		this.unmarshalType = unmarshalType;
+	}
+
+	public Class<? extends Collection> getCollectionType() {
+		return collectionType;
+	}
+
+	public void setCollectionType(Class<? extends Collection> collectionType) {
+		this.collectionType = collectionType;
+	}
+
+	public Class<?> getJsonView() {
+		return jsonView;
+	}
+
+	public void setJsonView(Class<?> jsonView) {
+		this.jsonView = jsonView;
+	}
+
+	public String getInclude() {
+		return include;
+	}
+
+	public void setInclude(String include) {
+		this.include = include;
+	}
+
+	public boolean isAllowJmsType() {
+		return allowJmsType;
+	}
+
+	public boolean isPrettyPrint() {
+		return prettyPrint;
+	}
+
+	public void setPrettyPrint(boolean prettyPrint) {
+		this.prettyPrint = prettyPrint;
+	}
+
+	public boolean isUseList() {
+		return useList;
+	}
+
+	public void setUseList(boolean useList) {
+		this.useList = useList;
+	}
+
+	public boolean isEnableJaxbAnnotationModule() {
+		return enableJaxbAnnotationModule;
+	}
+
+	public void setEnableJaxbAnnotationModule(boolean enableJaxbAnnotationModule) {
+		this.enableJaxbAnnotationModule = enableJaxbAnnotationModule;
+	}
+
+	public List<Module> getModules() {
+		return modules;
+	}
+
+	/**
+	 * To use custom Jackson {@link Module}s
+	 */
+	public void setModules(List<Module> modules) {
+		this.modules = modules;
+	}
+
+	public String getModuleClassNames() {
+		return moduleClassNames;
+	}
+
+	/**
+	 * To use the custom Jackson module
+	 */
+	public void addModule(Module module) {
+		if (this.modules == null) {
+			this.modules = new ArrayList<>();
+		}
+		this.modules.add(module);
+	}
+
+	/**
+	 * To use custom Jackson {@link Module}s specified as a String with FQN class
+	 * names. Multiple classes can be separated by comma.
+	 */
+	public void setModuleClassNames(String moduleClassNames) {
+		this.moduleClassNames = moduleClassNames;
+	}
+
+	public String getModuleRefs() {
+		return moduleRefs;
+	}
+
+	/**
+	 * To use custom Jackson modules referred from the Camel registry. Multiple
+	 * modules can be separated by comma.
+	 */
+	public void setModuleRefs(String moduleRefs) {
+		this.moduleRefs = moduleRefs;
+	}
+
+	/**
+	 * Uses {@link java.util.ArrayList} when unmarshalling.
+	 */
+	public void useList() {
+		setCollectionType(ArrayList.class);
+	}
+
+	/**
+	 * Uses {@link java.util.HashMap} when unmarshalling.
+	 */
+	public void useMap() {
+		setCollectionType(null);
+		setUnmarshalType(HashMap.class);
+	}
+
+	/**
+	 * Allows jackson to use the <tt>JMSType</tt> header as an indicator what the
+	 * classname is for unmarshaling json content to POJO
+	 * <p/>
+	 * By default this option is <tt>false</tt>.
+	 */
+	public void setAllowJmsType(boolean allowJmsType) {
+		this.allowJmsType = allowJmsType;
+	}
+
+	public boolean isEnableJacksonTypeConverter() {
+		return enableJacksonTypeConverter;
+	}
+
+	/**
+	 * If enabled then Jackson is allowed to attempt to be used during Camels
+	 * <a href="https://camel.apache.org/type-converter.html">type converter</a> as
+	 * a {@link org.apache.camel.FallbackConverter} that attempts to convert POJOs
+	 * to/from {@link Map}/{@link List} types.
+	 * <p/>
+	 * This should only be enabled when desired to be used.
+	 */
+	public void setEnableJacksonTypeConverter(boolean enableJacksonTypeConverter) {
+		this.enableJacksonTypeConverter = enableJacksonTypeConverter;
+	}
+
+	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 setAllowUnmarshallType(boolean allowJacksonUnmarshallType) {
+		this.allowUnmarshallType = allowJacksonUnmarshallType;
+	}
+
+	public boolean isContentTypeHeader() {
+		return contentTypeHeader;
+	}
+
+	/**
+	 * If enabled then Jackson will set the Content-Type header to
+	 * <tt>application/json</tt> when marshalling.
+	 */
+	public void setContentTypeHeader(boolean contentTypeHeader) {
+		this.contentTypeHeader = contentTypeHeader;
+	}
+
+	public TimeZone getTimezone() {
+		return timezone;
+	}
+
+	/**
+	 * If set then Jackson will use the Timezone when marshalling/unmarshalling.
+	 */
+	public void setTimezone(TimeZone timezone) {
+		this.timezone = timezone;
+	}
+
+	public boolean isAutoDiscoverObjectMapper() {
+		return autoDiscoverObjectMapper;
+	}
+
+	/**
+	 * If set to true then Jackson will lookup for an objectMapper into the registry
+	 */
+	public void setAutoDiscoverObjectMapper(boolean autoDiscoverObjectMapper) {
+		this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+	}
+
+	public String getEnableFeatures() {
+		return enableFeatures;
+	}
+
+	/**
+	 * Set of features to enable on the Jackson {@link ObjectMapper}. The features
+	 * should be a name that matches a enum from {@link SerializationFeature},
+	 * {@link DeserializationFeature}, or {@link MapperFeature}.
+	 */
+	public void setEnableFeatures(String enableFeatures) {
+		this.enableFeatures = enableFeatures;
+	}
+
+	public String getDisableFeatures() {
+		return disableFeatures;
+	}
+
+	/**
+	 * Set of features to disable on the Jackson {@link ObjectMapper}. The features
+	 * should be a name that matches a enum from {@link SerializationFeature},
+	 * {@link DeserializationFeature}, or {@link MapperFeature}.
+	 */
+	public void setDisableFeatures(String disableFeatures) {
+		this.disableFeatures = disableFeatures;
+	}
+
+	public void enableFeature(SerializationFeature feature) {
+		if (enableFeatures == null) {
+			enableFeatures = feature.name();
+		} else {
+			enableFeatures += "," + feature.name();
+		}
+	}
+
+	public void enableFeature(DeserializationFeature feature) {
+		if (enableFeatures == null) {
+			enableFeatures = feature.name();
+		} else {
+			enableFeatures += "," + feature.name();
+		}
+	}
+
+	public void enableFeature(MapperFeature feature) {
+		if (enableFeatures == null) {
+			enableFeatures = feature.name();
+		} else {
+			enableFeatures += "," + feature.name();
+		}
+	}
+
+	public void disableFeature(SerializationFeature feature) {
+		if (disableFeatures == null) {
+			disableFeatures = feature.name();
+		} else {
+			disableFeatures += "," + feature.name();
+		}
+	}
+
+	public void disableFeature(DeserializationFeature feature) {
+		if (disableFeatures == null) {
+			disableFeatures = feature.name();
+		} else {
+			disableFeatures += "," + feature.name();
+		}
+	}
+
+	public void disableFeature(MapperFeature feature) {
+		if (disableFeatures == null) {
+			disableFeatures = feature.name();
+		} else {
+			disableFeatures += "," + feature.name();
+		}
+	}
+
+	@Override
+	protected void doStart() throws Exception {
+		boolean objectMapperFoundRegistry = false;
+		if (objectMapper == null) {
+			// lookup if there is a single default mapper we can use
+			if (useDefaultObjectMapper && camelContext != null) {
+				if (isAutoDiscoverObjectMapper()) {
+					Set<ObjectMapper> set = camelContext.getRegistry().findByType(ObjectMapper.class);
+					if (set.size() == 1) {
+						objectMapper = set.iterator().next();
+						log.info("Found single ObjectMapper in Registry to use: {}", objectMapper);
+						objectMapperFoundRegistry = true;
+					} else if (set.size() > 1) {
+						log.debug(
+								"Found {} ObjectMapper in Registry cannot use as default as there are more than one instance.",
+								set.size());
+					}
+				} else {
+					log.warn("The option autoDiscoverObjectMapper is set to false, Camel won't search in the registry");
+				}
+			}
+			if (objectMapper == null) {
+				objectMapper = new ObjectMapper();
+				log.debug("Creating new ObjectMapper to use: {}", objectMapper);
+			}
+		}
+
+		if (!objectMapperFoundRegistry) {
+			if (enableJaxbAnnotationModule) {
+				// Enables JAXB processing
+				JaxbAnnotationModule module = new JaxbAnnotationModule();
+				log.debug("Registering JaxbAnnotationModule: {}", module);
+				objectMapper.registerModule(module);
+			}
+
+			if (useList) {
+				setCollectionType(ArrayList.class);
+			}
+			if (include != null) {
+				JsonInclude.Include inc = getCamelContext().getTypeConverter()
+						.mandatoryConvertTo(JsonInclude.Include.class, include);
+				objectMapper.setSerializationInclusion(inc);
+			}
+			if (prettyPrint) {
+				objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
+			}
+
+			if (enableFeatures != null) {
+				Iterator<?> it = ObjectHelper.createIterator(enableFeatures);
+				while (it.hasNext()) {
+					String enable = it.next().toString();
+					// it can be different kind
+					SerializationFeature sf = getCamelContext().getTypeConverter()
+							.tryConvertTo(SerializationFeature.class, enable);
+					if (sf != null) {
+						objectMapper.enable(sf);
+						continue;
+					}
+					DeserializationFeature df = getCamelContext().getTypeConverter()
+							.tryConvertTo(DeserializationFeature.class, enable);
+					if (df != null) {
+						objectMapper.enable(df);
+						continue;
+					}
+					MapperFeature mf = getCamelContext().getTypeConverter().tryConvertTo(MapperFeature.class, enable);
+					if (mf != null) {
+						objectMapper.enable(mf);
+						continue;
+					}
+					throw new IllegalArgumentException("Enable feature: " + enable
+							+ " cannot be converted to an accepted enum of types [SerializationFeature,DeserializationFeature,MapperFeature]");
+				}
+			}
+			if (disableFeatures != null) {
+				Iterator<?> it = ObjectHelper.createIterator(disableFeatures);
+				while (it.hasNext()) {
+					String disable = it.next().toString();
+					// it can be different kind
+					SerializationFeature sf = getCamelContext().getTypeConverter()
+							.tryConvertTo(SerializationFeature.class, disable);
+					if (sf != null) {
+						objectMapper.disable(sf);
+						continue;
+					}
+					DeserializationFeature df = getCamelContext().getTypeConverter()
+							.tryConvertTo(DeserializationFeature.class, disable);
+					if (df != null) {
+						objectMapper.disable(df);
+						continue;
+					}
+					MapperFeature mf = getCamelContext().getTypeConverter().tryConvertTo(MapperFeature.class, disable);
+					if (mf != null) {
+						objectMapper.disable(mf);
+						continue;
+					}
+					throw new IllegalArgumentException("Disable feature: " + disable
+							+ " cannot be converted to an accepted enum of types [SerializationFeature,DeserializationFeature,MapperFeature]");
+				}
+			}
+
+			if (modules != null) {
+				for (Module module : modules) {
+					log.debug("Registering module: {}", module);
+					objectMapper.registerModules(module);
+				}
+			}
+			if (moduleClassNames != null) {
+				Iterable<?> it = ObjectHelper.createIterable(moduleClassNames);
+				for (Object o : it) {
+					String name = o.toString();
+					Class<Module> clazz = camelContext.getClassResolver().resolveMandatoryClass(name, Module.class);
+					Module module = camelContext.getInjector().newInstance(clazz);
+					log.debug("Registering module: {} -> {}", name, module);
+					objectMapper.registerModule(module);
+				}
+			}
+			if (moduleRefs != null) {
+				Iterable<?> it = ObjectHelper.createIterable(moduleRefs);
+				for (Object o : it) {
+					String name = o.toString();
+					if (name.startsWith("#")) {
+						name = name.substring(1);
+					}
+					Module module = CamelContextHelper.mandatoryLookup(camelContext, name, Module.class);
+					log.debug("Registering module: {} -> {}", name, module);
+					objectMapper.registerModule(module);
+				}
+			}
+			if (org.apache.camel.util.ObjectHelper.isNotEmpty(timezone)) {
+				log.debug("Setting timezone to Object Mapper: {}", timezone);
+				objectMapper.setTimeZone(timezone);
+			}
+		}
+	}
+
+	@Override
+	protected void doStop() throws Exception {
+		// noop
+	}
 
 }
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectMapperRegistryTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectMapperRegistryTest.java
index 9eac4be..fc106ba 100644
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectMapperRegistryTest.java
+++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonObjectMapperRegistryTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.jackson;
 
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -25,11 +26,12 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Before;
 import org.junit.Test;
 
 public class JacksonObjectMapperRegistryTest extends CamelTestSupport {
 
-    private JacksonDataFormat df = new JacksonDataFormat();
+    private JacksonDataFormat df;
    
     @BindToRegistry("myMapper")
     private ObjectMapper objectMapper = new ObjectMapper();
@@ -60,6 +62,9 @@ public class JacksonObjectMapperRegistryTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+            	df = new JacksonDataFormat();
+            	df.setAutoDiscoverObjectMapper(true);
+            	
                 from("direct:in").marshal(df);
                 from("direct:back").unmarshal(df).to("mock:reverse");
             }
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index 5f77a15..cde365e 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -76,6 +76,9 @@ public class JsonDataFormat extends DataFormatDefinition {
     private Boolean allowUnmarshallType;
     @XmlAttribute
     private String timezone;
+    @XmlAttribute
+	private boolean autoDiscoverObjectMapper;    
+    
 
     public JsonDataFormat() {
         super("json");
@@ -365,6 +368,17 @@ public class JsonDataFormat extends DataFormatDefinition {
     public void setTimezone(String timezone) {
         this.timezone = timezone;
     }
+    
+	public boolean isAutoDiscoverObjectMapper() {
+		return autoDiscoverObjectMapper;
+	}
+
+	/**
+	 * If set to true then Jackson will lookup for an objectMapper into the registry
+	 */
+	public void setAutoDiscoverObjectMapper(boolean autoDiscoverObjectMapper) {
+		this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+	}
 
     @Override
     public String getDataFormatName() {


[camel] 07/07: Regen

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 58d91ce6307d13212890c55c725743666373b461
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 30 09:56:50 2019 +0100

    Regen
---
 components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc | 2 +-
 components/camel-gson/src/main/docs/json-gson-dataformat.adoc         | 2 +-
 docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc      | 2 +-
 docs/components/modules/ROOT/pages/json-gson-dataformat.adoc          | 2 +-
 docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc       | 2 +-
 docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc       | 2 +-
 docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc       | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc b/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
index bbfc3fc..a5ab07f 100644
--- a/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
+++ b/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
@@ -42,7 +42,7 @@ The JSon Fastjson dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
index dc221c0..d2e57bf 100644
--- a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
+++ b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
@@ -42,7 +42,7 @@ The JSon GSon dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc b/docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc
index ef7794e..c25a265 100644
--- a/docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc
@@ -43,7 +43,7 @@ The JSon Fastjson dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/docs/components/modules/ROOT/pages/json-gson-dataformat.adoc b/docs/components/modules/ROOT/pages/json-gson-dataformat.adoc
index 8971fb8..aa05122 100644
--- a/docs/components/modules/ROOT/pages/json-gson-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-gson-dataformat.adoc
@@ -43,7 +43,7 @@ The JSon GSon dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc b/docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc
index 5e07816..1d7cd67 100644
--- a/docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc
@@ -44,7 +44,7 @@ The JSon Jackson dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc b/docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc
index e0a9baa..a5352fe 100644
--- a/docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc
@@ -44,7 +44,7 @@ The JSon Johnzon dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc b/docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc
index f92cced..a756f83 100644
--- a/docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc
@@ -54,7 +54,7 @@ The JSon XStream dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END


[camel] 02/07: CAMEL-14101 - Regen

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 193fe72d0a4edef66f95268224282156857db3ef
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 30 09:24:12 2019 +0100

    CAMEL-14101 - Regen
---
 .../src/main/docs/json-fastjson-dataformat.adoc             |  6 ++++--
 .../camel-gson/src/main/docs/json-gson-dataformat.adoc      |  6 ++++--
 .../src/main/docs/json-jackson-dataformat.adoc              |  6 ++++--
 .../src/main/docs/json-johnzon-dataformat.adoc              |  6 ++++--
 .../src/main/docs/json-xstream-dataformat.adoc              |  3 ++-
 .../camel-xstream/src/main/docs/xstream-dataformat.adoc     |  3 ++-
 .../modules/ROOT/pages/json-fastjson-dataformat.adoc        |  6 ++++--
 .../components/modules/ROOT/pages/json-gson-dataformat.adoc |  6 ++++--
 .../modules/ROOT/pages/json-jackson-dataformat.adoc         |  6 ++++--
 .../modules/ROOT/pages/json-johnzon-dataformat.adoc         |  6 ++++--
 .../modules/ROOT/pages/json-xstream-dataformat.adoc         |  3 ++-
 docs/components/modules/ROOT/pages/xstream-dataformat.adoc  |  3 ++-
 .../springboot/FastjsonDataFormatConfiguration.java         | 13 +++++++++++++
 .../gson/springboot/GsonDataFormatConfiguration.java        | 13 +++++++++++++
 .../jackson/springboot/JacksonDataFormatConfiguration.java  | 13 +++++++++++++
 .../johnzon/springboot/JohnzonDataFormatConfiguration.java  | 13 +++++++++++++
 .../xstream/springboot/JsonDataFormatConfiguration.java     | 13 +++++++++++++
 17 files changed, 105 insertions(+), 20 deletions(-)

diff --git a/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc b/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
index 9bf56b4..bbfc3fc 100644
--- a/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
+++ b/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
@@ -17,7 +17,7 @@ from("activemq:My.Queue").
 
 
 // dataformat options: START
-The JSon Fastjson dataformat supports 19 options, which are listed below.
+The JSon Fastjson dataformat supports 20 options, which are listed below.
 
 
 
@@ -42,6 +42,7 @@ The JSon Fastjson dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
@@ -61,7 +62,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 19 options, which are listed below.
+The component supports 20 options, which are listed below.
 
 
 
@@ -70,6 +71,7 @@ The component supports 19 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-fastjson.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-fastjson.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-fastjson.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-fastjson.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-fastjson.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-fastjson.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
index 69b1678..dc221c0 100644
--- a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
+++ b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
@@ -17,7 +17,7 @@ from("activemq:My.Queue").
 
 
 // dataformat options: START
-The JSon GSon dataformat supports 19 options, which are listed below.
+The JSon GSon dataformat supports 20 options, which are listed below.
 
 
 
@@ -42,6 +42,7 @@ The JSon GSon dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
@@ -61,7 +62,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 19 options, which are listed below.
+The component supports 20 options, which are listed below.
 
 
 
@@ -70,6 +71,7 @@ The component supports 19 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-gson.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-gson.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-gson.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-gson.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-gson.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-gson.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
index 8643255..86d7fb8 100644
--- a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
+++ b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
@@ -18,7 +18,7 @@ from("activemq:My.Queue").
 
 
 // dataformat options: START
-The JSon Jackson dataformat supports 19 options, which are listed below.
+The JSon Jackson dataformat supports 20 options, which are listed below.
 
 
 
@@ -43,6 +43,7 @@ The JSon Jackson dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
@@ -62,7 +63,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 19 options, which are listed below.
+The component supports 20 options, which are listed below.
 
 
 
@@ -71,6 +72,7 @@ The component supports 19 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-jackson.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-jackson.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-jackson.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-jackson.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-jackson.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-jackson.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
index 6fa5c6b..4939fc6 100644
--- a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
+++ b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
@@ -18,7 +18,7 @@ from("activemq:My.Queue").
 
 
 // dataformat options: START
-The JSon Johnzon dataformat supports 19 options, which are listed below.
+The JSon Johnzon dataformat supports 20 options, which are listed below.
 
 
 
@@ -43,6 +43,7 @@ The JSon Johnzon dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
@@ -62,7 +63,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 19 options, which are listed below.
+The component supports 20 options, which are listed below.
 
 
 
@@ -71,6 +72,7 @@ The component supports 19 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-johnzon.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-johnzon.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-johnzon.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-johnzon.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-johnzon.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-johnzon.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc b/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
index 3296435..5c3c52c 100644
--- a/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
+++ b/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
@@ -28,7 +28,7 @@ Maven users will need to add the following dependency to their
 == Options
 
 // dataformat options: START
-The JSon XStream dataformat supports 19 options, which are listed below.
+The JSon XStream dataformat supports 20 options, which are listed below.
 
 
 
@@ -53,6 +53,7 @@ The JSon XStream dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/components/camel-xstream/src/main/docs/xstream-dataformat.adoc b/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
index bb49987..5a46b42 100644
--- a/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
+++ b/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
@@ -61,7 +61,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 30 options, which are listed below.
+The component supports 31 options, which are listed below.
 
 
 
@@ -70,6 +70,7 @@ The component supports 30 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-xstream.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-xstream.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-xstream.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-xstream.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-xstream.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-xstream.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc b/docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc
index 1f65a7a..ef7794e 100644
--- a/docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-fastjson-dataformat.adoc
@@ -18,7 +18,7 @@ from("activemq:My.Queue").
 
 
 // dataformat options: START
-The JSon Fastjson dataformat supports 19 options, which are listed below.
+The JSon Fastjson dataformat supports 20 options, which are listed below.
 
 
 
@@ -43,6 +43,7 @@ The JSon Fastjson dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
@@ -62,7 +63,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 19 options, which are listed below.
+The component supports 20 options, which are listed below.
 
 
 
@@ -71,6 +72,7 @@ The component supports 19 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-fastjson.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-fastjson.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-fastjson.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-fastjson.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-fastjson.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-fastjson.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/docs/components/modules/ROOT/pages/json-gson-dataformat.adoc b/docs/components/modules/ROOT/pages/json-gson-dataformat.adoc
index 74134ee..8971fb8 100644
--- a/docs/components/modules/ROOT/pages/json-gson-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-gson-dataformat.adoc
@@ -18,7 +18,7 @@ from("activemq:My.Queue").
 
 
 // dataformat options: START
-The JSon GSon dataformat supports 19 options, which are listed below.
+The JSon GSon dataformat supports 20 options, which are listed below.
 
 
 
@@ -43,6 +43,7 @@ The JSon GSon dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
@@ -62,7 +63,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 19 options, which are listed below.
+The component supports 20 options, which are listed below.
 
 
 
@@ -71,6 +72,7 @@ The component supports 19 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-gson.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-gson.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-gson.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-gson.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-gson.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-gson.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc b/docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc
index 139ee60..5e07816 100644
--- a/docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-jackson-dataformat.adoc
@@ -19,7 +19,7 @@ from("activemq:My.Queue").
 
 
 // dataformat options: START
-The JSon Jackson dataformat supports 19 options, which are listed below.
+The JSon Jackson dataformat supports 20 options, which are listed below.
 
 
 
@@ -44,6 +44,7 @@ The JSon Jackson dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
@@ -63,7 +64,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 19 options, which are listed below.
+The component supports 20 options, which are listed below.
 
 
 
@@ -72,6 +73,7 @@ The component supports 19 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-jackson.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-jackson.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-jackson.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-jackson.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-jackson.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-jackson.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc b/docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc
index fd301a9..e0a9baa 100644
--- a/docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-johnzon-dataformat.adoc
@@ -19,7 +19,7 @@ from("activemq:My.Queue").
 
 
 // dataformat options: START
-The JSon Johnzon dataformat supports 19 options, which are listed below.
+The JSon Johnzon dataformat supports 20 options, which are listed below.
 
 
 
@@ -44,6 +44,7 @@ The JSon Johnzon dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
@@ -63,7 +64,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 19 options, which are listed below.
+The component supports 20 options, which are listed below.
 
 
 
@@ -72,6 +73,7 @@ The component supports 19 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-johnzon.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-johnzon.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-johnzon.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-johnzon.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-johnzon.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-johnzon.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc b/docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc
index 866bb44..f92cced 100644
--- a/docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/json-xstream-dataformat.adoc
@@ -29,7 +29,7 @@ Maven users will need to add the following dependency to their
 == Options
 
 // dataformat options: START
-The JSon XStream dataformat supports 19 options, which are listed below.
+The JSon XStream dataformat supports 20 options, which are listed below.
 
 
 
@@ -54,6 +54,7 @@ The JSon XStream dataformat supports 19 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
+| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/docs/components/modules/ROOT/pages/xstream-dataformat.adoc b/docs/components/modules/ROOT/pages/xstream-dataformat.adoc
index 0894242..ce4a971 100644
--- a/docs/components/modules/ROOT/pages/xstream-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/xstream-dataformat.adoc
@@ -62,7 +62,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 30 options, which are listed below.
+The component supports 31 options, which are listed below.
 
 
 
@@ -71,6 +71,7 @@ The component supports 30 options, which are listed below.
 | Name | Description | Default | Type
 | *camel.dataformat.json-xstream.allow-jms-type* | Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. | false | Boolean
 | *camel.dataformat.json-xstream.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.json-xstream.auto-discover-object-mapper* | If set to true then Jackson will lookup for an objectMapper into the registry | false | Boolean
 | *camel.dataformat.json-xstream.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
 | *camel.dataformat.json-xstream.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
 | *camel.dataformat.json-xstream.disable-features* | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma |  | String
diff --git a/platforms/spring-boot/components-starter/camel-fastjson-starter/src/main/java/org/apache/camel/component/fastjson/springboot/FastjsonDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-fastjson-starter/src/main/java/org/apache/camel/component/fastjson/springboot/FastjsonDataFormatConfiguration.java
index 6e1b817..4586c79 100644
--- a/platforms/spring-boot/components-starter/camel-fastjson-starter/src/main/java/org/apache/camel/component/fastjson/springboot/FastjsonDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-fastjson-starter/src/main/java/org/apache/camel/component/fastjson/springboot/FastjsonDataFormatConfiguration.java
@@ -144,6 +144,11 @@ public class FastjsonDataFormatConfiguration
      */
     private String timezone;
     /**
+     * If set to true then Jackson will lookup for an objectMapper into the
+     * registry
+     */
+    private Boolean autoDiscoverObjectMapper = false;
+    /**
      * Whether the data format should set the Content-Type header with the type
      * from the data format if the data format is capable of doing so. For
      * example application/xml for data formats marshalling to XML, or
@@ -287,6 +292,14 @@ public class FastjsonDataFormatConfiguration
         this.timezone = timezone;
     }
 
+    public Boolean getAutoDiscoverObjectMapper() {
+        return autoDiscoverObjectMapper;
+    }
+
+    public void setAutoDiscoverObjectMapper(Boolean autoDiscoverObjectMapper) {
+        this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+    }
+
     public Boolean getContentTypeHeader() {
         return contentTypeHeader;
     }
diff --git a/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatConfiguration.java
index 61adb5a..601ac54 100644
--- a/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatConfiguration.java
@@ -144,6 +144,11 @@ public class GsonDataFormatConfiguration
      */
     private String timezone;
     /**
+     * If set to true then Jackson will lookup for an objectMapper into the
+     * registry
+     */
+    private Boolean autoDiscoverObjectMapper = false;
+    /**
      * Whether the data format should set the Content-Type header with the type
      * from the data format if the data format is capable of doing so. For
      * example application/xml for data formats marshalling to XML, or
@@ -287,6 +292,14 @@ public class GsonDataFormatConfiguration
         this.timezone = timezone;
     }
 
+    public Boolean getAutoDiscoverObjectMapper() {
+        return autoDiscoverObjectMapper;
+    }
+
+    public void setAutoDiscoverObjectMapper(Boolean autoDiscoverObjectMapper) {
+        this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+    }
+
     public Boolean getContentTypeHeader() {
         return contentTypeHeader;
     }
diff --git a/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConfiguration.java
index b1b3311..a28db68 100644
--- a/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConfiguration.java
@@ -144,6 +144,11 @@ public class JacksonDataFormatConfiguration
      */
     private String timezone;
     /**
+     * If set to true then Jackson will lookup for an objectMapper into the
+     * registry
+     */
+    private Boolean autoDiscoverObjectMapper = false;
+    /**
      * Whether the data format should set the Content-Type header with the type
      * from the data format if the data format is capable of doing so. For
      * example application/xml for data formats marshalling to XML, or
@@ -287,6 +292,14 @@ public class JacksonDataFormatConfiguration
         this.timezone = timezone;
     }
 
+    public Boolean getAutoDiscoverObjectMapper() {
+        return autoDiscoverObjectMapper;
+    }
+
+    public void setAutoDiscoverObjectMapper(Boolean autoDiscoverObjectMapper) {
+        this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+    }
+
     public Boolean getContentTypeHeader() {
         return contentTypeHeader;
     }
diff --git a/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatConfiguration.java
index bbfd065..91b7348 100644
--- a/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatConfiguration.java
@@ -144,6 +144,11 @@ public class JohnzonDataFormatConfiguration
      */
     private String timezone;
     /**
+     * If set to true then Jackson will lookup for an objectMapper into the
+     * registry
+     */
+    private Boolean autoDiscoverObjectMapper = false;
+    /**
      * Whether the data format should set the Content-Type header with the type
      * from the data format if the data format is capable of doing so. For
      * example application/xml for data formats marshalling to XML, or
@@ -287,6 +292,14 @@ public class JohnzonDataFormatConfiguration
         this.timezone = timezone;
     }
 
+    public Boolean getAutoDiscoverObjectMapper() {
+        return autoDiscoverObjectMapper;
+    }
+
+    public void setAutoDiscoverObjectMapper(Boolean autoDiscoverObjectMapper) {
+        this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+    }
+
     public Boolean getContentTypeHeader() {
         return contentTypeHeader;
     }
diff --git a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java
index ed9b5c7..6c32546 100644
--- a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java
@@ -144,6 +144,11 @@ public class JsonDataFormatConfiguration
      */
     private String timezone;
     /**
+     * If set to true then Jackson will lookup for an objectMapper into the
+     * registry
+     */
+    private Boolean autoDiscoverObjectMapper = false;
+    /**
      * Whether the data format should set the Content-Type header with the type
      * from the data format if the data format is capable of doing so. For
      * example application/xml for data formats marshalling to XML, or
@@ -287,6 +292,14 @@ public class JsonDataFormatConfiguration
         this.timezone = timezone;
     }
 
+    public Boolean getAutoDiscoverObjectMapper() {
+        return autoDiscoverObjectMapper;
+    }
+
+    public void setAutoDiscoverObjectMapper(Boolean autoDiscoverObjectMapper) {
+        this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
+    }
+
     public Boolean getContentTypeHeader() {
         return contentTypeHeader;
     }


[camel] 03/07: CAMEL-14101 - Use Boolean and not boolean in JsonDataFormat

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 83ec8ebaddad38b81301f9e53ee121130fe016ea
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Oct 30 09:24:20 2019 +0100

    CAMEL-14101 - Use Boolean and not boolean in JsonDataFormat
---
 .../camel-jackson/src/main/docs/json-jackson-dataformat.adoc       | 2 +-
 .../camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc       | 2 +-
 .../java/org/apache/camel/model/dataformat/JsonDataFormat.java     | 7 ++++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
index 86d7fb8..0053ed0 100644
--- a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
+++ b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
@@ -43,7 +43,7 @@ The JSon Jackson dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
index 4939fc6..b8d25a5 100644
--- a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
+++ b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
@@ -43,7 +43,7 @@ The JSon Johnzon dataformat supports 20 options, which are listed below.
 | permissions |  | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow, and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be conf [...]
 | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
 | timezone |  | String | If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | boolean | If set to true then Jackson will lookup for an objectMapper into the registry
+| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson will lookup for an objectMapper into the registry
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index cde365e..06f350f 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -77,7 +77,8 @@ public class JsonDataFormat extends DataFormatDefinition {
     @XmlAttribute
     private String timezone;
     @XmlAttribute
-	private boolean autoDiscoverObjectMapper;    
+    @Metadata(defaultValue = "false")
+	private Boolean autoDiscoverObjectMapper;    
     
 
     public JsonDataFormat() {
@@ -369,14 +370,14 @@ public class JsonDataFormat extends DataFormatDefinition {
         this.timezone = timezone;
     }
     
-	public boolean isAutoDiscoverObjectMapper() {
+	public Boolean isAutoDiscoverObjectMapper() {
 		return autoDiscoverObjectMapper;
 	}
 
 	/**
 	 * If set to true then Jackson will lookup for an objectMapper into the registry
 	 */
-	public void setAutoDiscoverObjectMapper(boolean autoDiscoverObjectMapper) {
+	public void setAutoDiscoverObjectMapper(Boolean autoDiscoverObjectMapper) {
 		this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
 	}