You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2016/06/16 06:36:05 UTC
[jira] [Resolved] (CAMEL-10059) Add option to generate Java 1.8
Optional> based DTOs
[ https://issues.apache.org/jira/browse/CAMEL-10059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-10059.
---------------------------------
Resolution: Fixed
Assignee: Claus Ibsen
Fix Version/s: 2.18.0
Thanks for the PR
> Add option to generate Java 1.8 Optional<?> based DTOs
> ------------------------------------------------------
>
> Key: CAMEL-10059
> URL: https://issues.apache.org/jira/browse/CAMEL-10059
> Project: Camel
> Issue Type: New Feature
> Components: camel-salesforce
> Reporter: Sune Keller
> Assignee: Claus Ibsen
> Priority: Minor
> Labels: camel-salesforce, jackson2, salesforce
> Fix For: 2.18.0
>
>
> See GitHub PR: https://github.com/apache/camel/pull/1033
> Also upgrades to Jackson 2.x to allow injecting a custom {{ObjectMapper}} into {{SalesforceEndpointConfig}}, which in turn allows registering the {{Jdk8Module}} when using Java 1.8, which handles (de)serializing of {{Optional<?>}} in a reasonable manner. Jackson 1.x does not have the {{Jdk8Module}}.
> Note that this requires that the project using the plugin is itself using Java 1.8+.
> To use {{Jdk8Module}}, add this dependency:
> {code:xml}
> <dependency>
> <groupId>com.fasterxml.jackson.datatype</groupId>
> <artifactId>jackson-datatype-jdk8</artifactId>
> </dependency>
> {code}
> Then configure a custom {{ObjectMapper}} like the following snippet:
> {code}
> import org.apache.camel.component.salesforce.SalesforceEndpointConfig;
> ...
> import com.fasterxml.jackson.databind.ObjectMapper;
> import com.fasterxml.jackson.databind.SerializationFeature;
> import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
> ...
> @Bean
> public SalesforceEndpointConfig salesforceEndpointConfig() {
> SalesforceEndpointConfig salesforceEndpointConfig = new SalesforceEndpointConfig();
> ...
> ObjectMapper objectMapper = new ObjectMapper();
> objectMapper.registerModule(new Jdk8Module());
> objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
> salesforceEndpointConfig.setObjectMapper(objectMapper);
> return salesforceEndpointConfig;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)