activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-565 another JSON fix
Date Mon, 01 Aug 2016 18:15:50 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 57f79cae0 -> ae47eae5a


ARTEMIS-565 another JSON fix


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a5360e42
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a5360e42
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a5360e42

Branch: refs/heads/master
Commit: a5360e42df3055dec9524936e733a0f8bcee153c
Parents: 57f79ca
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Aug 1 13:54:04 2016 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Aug 1 13:54:04 2016 -0400

----------------------------------------------------------------------
 .../activemq/artemis/api/core/JsonUtil.java       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a5360e42/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java
index 0343a64..e50540d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java
@@ -325,6 +325,24 @@ public final class JsonUtil {
             return jsonValue.toString();
          }
       }
+      else if (jsonValue instanceof  Number) {
+         Number jsonNumber = (Number)jsonValue;
+         if (desiredType == Integer.TYPE || desiredType == Integer.class) {
+            return  jsonNumber.intValue();
+         }
+         else if (desiredType == Long.TYPE || desiredType == Long.class) {
+            return jsonNumber.longValue();
+         }
+         else if (desiredType == Double.TYPE || desiredType == Double.class) {
+            return jsonNumber.doubleValue();
+         }
+         else if (desiredType == Short.TYPE || desiredType == Short.class) {
+            return jsonNumber.shortValue();
+         }
+         else {
+            return jsonValue;
+         }
+      }
       else if (jsonValue instanceof Object[]) {
          Object[] array = (Object[]) jsonValue;
          for (int i = 0; i < array.length; i++) {


Mime
View raw message