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

sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit 6a564cf105ca7112206c1cb27f56d803127dd8ba
Author: Sebastian Rühl <sru...@apache.org>
AuthorDate: Thu Jun 21 11:16:41 2018 +0200

    added a basic type converter to the camel component
---
 .../plc4x/camel/ResponseItemTypeConverter.java     | 34 ++++++++++++++++++++++
 .../services/org/apache/camel/TypeConverter        |  1 +
 2 files changed, 35 insertions(+)

diff --git 
a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/ResponseItemTypeConverter.java
 
b/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/ResponseItemTypeConverter.java
new file mode 100644
index 0000000..e99d0c1
--- /dev/null
+++ 
b/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/ResponseItemTypeConverter.java
@@ -0,0 +1,34 @@
+/*
+ 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.plc4x.camel;
+
+import org.apache.camel.Converter;
+import org.apache.plc4x.java.api.messages.items.ReadResponseItem;
+
+import java.util.stream.Collectors;
+
+@Converter
+public class ResponseItemTypeConverter {
+
+    @Converter
+    public static String toString(ReadResponseItem<?> responseItem) {
+        return 
responseItem.getValues().stream().map(String::valueOf).collect(Collectors.joining(","));
+    }
+
+}
diff --git 
a/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
 
b/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
new file mode 100644
index 0000000..ad8d2e5
--- /dev/null
+++ 
b/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -0,0 +1 @@
+org.apache.plc4x.camel.ResponseItemTypeConverter
\ No newline at end of file

Reply via email to