You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/03/31 10:53:26 UTC
[2/7] camel git commit: Revert "[CAMEL-8554] Jackons component now
provides map => pojo fallback converter."
Revert "[CAMEL-8554] Jackons component now provides map => pojo fallback converter."
This reverts commit 2fa60111add917affc161570892efda4a763f56a.
Conflicts:
components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/60ef47d6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/60ef47d6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/60ef47d6
Branch: refs/heads/master
Commit: 60ef47d6e8086f3d0b1edc03ceb29b2c5fb24d15
Parents: 772d537
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 31 10:04:11 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 31 10:04:11 2015 +0200
----------------------------------------------------------------------
.../converter/JacksonTypeConverters.java | 45 -----------------
.../services/org/apache/camel/TypeConverter | 17 -------
.../jackson/JacksonConversionsTest.java | 51 --------------------
3 files changed, 113 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/60ef47d6/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 6db03a1..0000000
--- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jackson.converter;
-
-import java.util.Map;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.camel.Exchange;
-import org.apache.camel.FallbackConverter;
-import org.apache.camel.spi.TypeConverterRegistry;
-
-public final class JacksonTypeConverters {
-
- private JacksonTypeConverters() {
- }
-
- @FallbackConverter
- public static <T> T convertTo(Class<T> type, Exchange exchange, Object value, TypeConverterRegistry registry) {
- if (value instanceof Map) {
- try {
- return new ObjectMapper().convertValue(value, type);
- } catch (Exception ex) {
- // Just catch the exception and return null when the ObjectMapper cannot convert the value
- return null;
- }
- }
- // Just return null to let other fallback converter to do the job
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/60ef47d6/components/camel-jackson/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
----------------------------------------------------------------------
diff --git a/components/camel-jackson/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-jackson/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
deleted file mode 100644
index 6ad0528..0000000
--- a/components/camel-jackson/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-org.apache.camel.component.jackson.converter.JacksonTypeConverters
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/60ef47d6/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsTest.java
deleted file mode 100644
index 20427b5..0000000
--- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonConversionsTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jackson;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class JacksonConversionsTest extends CamelTestSupport {
- protected MockEndpoint results;
-
- @Test
- public void shouldConvertMapToPojo() {
- String name = "someName";
- Map<String, String> pojoAsMap = new HashMap<String, String>();
- pojoAsMap.put("name", name);
-
- TestPojo testPojo = (TestPojo) template.requestBody("direct:test", pojoAsMap);
-
- assertEquals(name, testPojo.getName());
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:test").convertBodyTo(TestPojo.class);
- }
- };
- }
-
-}