[camel] branch master updated: Allow setting DataValue and Variant directly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[camel] branch master updated: Allow setting DataValue and Variant directly

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ad6c29d  Allow setting DataValue and Variant directly
ad6c29d is described below

commit ad6c29d0478e52d02b1d182f1fa00e136b7382c9
Author: Jens Reimann <[hidden email]>
AuthorDate: Mon Oct 8 16:40:27 2018 +0200

    Allow setting DataValue and Variant directly
---
 .../camel/component/milo/server/internal/CamelServerItem.java     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CamelServerItem.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CamelServerItem.java
index e5a6c4e5..f3b5d2a 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CamelServerItem.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/internal/CamelServerItem.java
@@ -139,7 +139,13 @@ public class CamelServerItem {
     }
 
     public void update(final Object value) {
-        this.value = new DataValue(new Variant(value), StatusCode.GOOD, DateTime.now());
+        if (value instanceof DataValue) {
+            this.value = (DataValue)value;
+        } else if (value instanceof Variant) {
+            this.value = new DataValue((Variant)value, StatusCode.GOOD, DateTime.now());
+        } else {
+            this.value = new DataValue(new Variant(value), StatusCode.GOOD, DateTime.now());
+        }
     }
 
     @Override