camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sune Keller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-10059) Add option to generate Java 1.8 Optional<?> based DTOs
Date Wed, 15 Jun 2016 08:04:09 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-10059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15331332#comment-15331332
] 

Sune Keller commented on CAMEL-10059:
-------------------------------------

Ping [~davsclaus]

> 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
>            Priority: Minor
>              Labels: camel-salesforce, jackson2, salesforce
>
> 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)

Mime
View raw message