cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [4/4] cxf git commit: [CXF-3574] Support additional JMS property types
Date Thu, 23 Mar 2017 17:14:25 GMT
[CXF-3574] Support additional JMS property types


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0e8a68c2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0e8a68c2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0e8a68c2

Branch: refs/heads/3.0.x-fixes
Commit: 0e8a68c2a6f1c53e24beb73bf9e9efeaa8316c96
Parents: 819c49a
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Mar 22 18:39:58 2017 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Mar 23 13:13:57 2017 -0400

----------------------------------------------------------------------
 .../cxf/transport/jms/JMSMessageUtils.java      | 26 +++++++++++++++++++-
 .../cxf/transport/jms/JMSPropertyType.java      | 19 +++++++-------
 2 files changed, 34 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0e8a68c2/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
index 4f16cf3..3d532e1 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
@@ -383,7 +383,31 @@ final class JMSMessageUtils {
         
         if (messageProperties.isSetProperty()) {
             for (JMSPropertyType prop : messageProperties.getProperty()) {
-                jmsMessage.setStringProperty(prop.getName(), prop.getValue());
+                Object o = prop.getValue();
+                if (o != null) {
+                    Class<?> cls = o.getClass();
+                    if (cls == String.class) {
+                        jmsMessage.setStringProperty(prop.getName(), (String)o);
+                    } else if (cls == Integer.TYPE || cls == Integer.class) {
+                        jmsMessage.setIntProperty(prop.getName(), (Integer)o);
+                    } else if (cls == Double.TYPE || cls == Double.class) {
+                        jmsMessage.setDoubleProperty(prop.getName(), (Double)o);
+                    } else if (cls == Float.TYPE || cls == Float.class) {
+                        jmsMessage.setFloatProperty(prop.getName(), (Float)o);
+                    } else if (cls == Long.TYPE || cls == Long.class) {
+                        jmsMessage.setLongProperty(prop.getName(), (Long)o);
+                    } else if (cls == Boolean.TYPE || cls == Boolean.class) {
+                        jmsMessage.setBooleanProperty(prop.getName(), (Boolean)o);
+                    } else if (cls == Short.TYPE || cls == Short.class) {
+                        jmsMessage.setShortProperty(prop.getName(), (Short)o);
+                    } else if (cls == Byte.TYPE || cls == Byte.class) {
+                        jmsMessage.setShortProperty(prop.getName(), (Byte)o);
+                    } else {
+                        jmsMessage.setObjectProperty(prop.getName(), o);
+                    }
+                } else {
+                    jmsMessage.setStringProperty(prop.getName(), null);
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/0e8a68c2/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSPropertyType.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSPropertyType.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSPropertyType.java
index 0574800..3d9a8f5 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSPropertyType.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSPropertyType.java
@@ -18,34 +18,33 @@
  */
 package org.apache.cxf.transport.jms;
 
-//CHECKSTYLE:OFF
 public class JMSPropertyType {
     protected String name;
-    protected String value;
+    protected Object value;
 
     public String getName() {
         return name;
     }
 
-    public void setName(String value) {
-        this.name = value;
+    public void setName(String name) {
+        this.name = name;
     }
 
     public boolean isSetName() {
-        return (this.name != null);
+        return this.name != null;
     }
 
-    public String getValue() {
+    public Object getValue() {
         return value;
     }
 
-    public void setValue(String value) {
+    public void setValue(Object value) {
         this.value = value;
     }
 
     public boolean isSetValue() {
-        return (this.value != null);
+        return this.value != null;
     }
-
+    
 }
-//CHECKSTYLE:ON
+


Mime
View raw message