kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [07/27] kylin git commit: org.apache.kylin.metadata.model.FunctionDesc#configuration should use default linkedhashmap to keep order
Date Fri, 02 Dec 2016 13:19:00 GMT
org.apache.kylin.metadata.model.FunctionDesc#configuration should use default linkedhashmap
to keep order


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/93bf0d02
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/93bf0d02
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/93bf0d02

Branch: refs/heads/KYLIN-1875
Commit: 93bf0d0214fe446d794b61e02fb18ff8097611d1
Parents: 30cb1ac
Author: Hongbin Ma <mahongbin@apache.org>
Authored: Thu Dec 1 11:20:53 2016 +0800
Committer: Hongbin Ma <mahongbin@apache.org>
Committed: Thu Dec 1 11:40:25 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/common/util/JacksonBean.java    | 16 ++++++++++++++++
 .../apache/kylin/common/util/JacksonTest.java    | 19 +++++++++++++++----
 .../kylin/metadata/model/FunctionDesc.java       |  8 ++++----
 3 files changed, 35 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/93bf0d02/core-common/src/test/java/org/apache/kylin/common/util/JacksonBean.java
----------------------------------------------------------------------
diff --git a/core-common/src/test/java/org/apache/kylin/common/util/JacksonBean.java b/core-common/src/test/java/org/apache/kylin/common/util/JacksonBean.java
index 42357f2..ffff6d1 100644
--- a/core-common/src/test/java/org/apache/kylin/common/util/JacksonBean.java
+++ b/core-common/src/test/java/org/apache/kylin/common/util/JacksonBean.java
@@ -23,6 +23,10 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 @JsonAutoDetect(fieldVisibility = Visibility.NONE, getterVisibility = Visibility.NONE, isGetterVisibility
= Visibility.NONE, setterVisibility = Visibility.NONE)
 public class JacksonBean {
 
@@ -32,6 +36,10 @@ public class JacksonBean {
     @JsonInclude(JsonInclude.Include.NON_NULL)
     private int b;
 
+    @JsonProperty("configuration")
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private Map<String, String> configuration = new HashMap<String, String>();
+
     public String getA() {
         return a;
     }
@@ -48,6 +56,14 @@ public class JacksonBean {
         this.b = b;
     }
 
+    public Map<String, String> getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(Map<String, String> configuration) {
+        this.configuration = configuration;
+    }
+
     @Override
     public String toString() {
         return "JacksonBean{" + "a='" + a + '\'' + ", b=" + b + '}';

http://git-wip-us.apache.org/repos/asf/kylin/blob/93bf0d02/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java
----------------------------------------------------------------------
diff --git a/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java b/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java
index 81be7eb..0d7097a 100644
--- a/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java
+++ b/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java
@@ -18,22 +18,33 @@
 
 package org.apache.kylin.common.util;
 
-import java.io.IOException;
-
 import org.junit.Test;
 
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
 public class JacksonTest {
     @Test
     public void foo() throws IOException {
+        HashMap a = new HashMap<String, String>();
+        a.put("1", "1");
+        a.put("3", "3");
+        a.put("2", "2");
+
+
         JacksonBean bean = new JacksonBean();
         bean.setA("valuea");
+        bean.setConfiguration(a);
 
         String s = JsonUtil.writeValueAsString(bean);
         System.out.println(s);
 
-        JacksonBean desBean = (JacksonBean) JsonUtil.readValue("{\"a\":\"valuea\"}", JacksonBean.class);
+        JacksonBean desBean = (JacksonBean) JsonUtil.readValue("{\"a\":\"valuea\",\"b\":0,\"configuration\":{\"2\":\"2\",\"3\":\"3\",\"1\":\"1\"}}",
JacksonBean.class);
+        
         String x2 = JsonUtil.writeValueAsString(desBean);
-        System.out.println(desBean);
         System.out.println(x2);
+        
+        System.out.println(desBean);
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/93bf0d02/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
b/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
index ae7f805..7b41552 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
@@ -19,8 +19,8 @@
 package org.apache.kylin.metadata.model;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.kylin.measure.MeasureType;
@@ -67,7 +67,7 @@ public class FunctionDesc {
 
     @JsonProperty("configuration")
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
-    private HashMap<String, String> configuration = new LinkedHashMap<String, String>();
+    private Map<String, String> configuration = new LinkedHashMap<String, String>();
 
     private DataType returnDataType;
     private MeasureType<?> measureType;
@@ -238,11 +238,11 @@ public class FunctionDesc {
         this.returnDataType = DataType.getType(returnType);
     }
 
-    public HashMap<String, String> getConfiguration() {
+    public Map<String, String> getConfiguration() {
         return configuration;
     }
 
-    public void setConfiguration(HashMap<String, String> configurations) {
+    public void setConfiguration(Map<String, String> configurations) {
         this.configuration = configurations;
     }
 


Mime
View raw message