You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2018/09/20 07:23:13 UTC
[incubator-skywalking-oal-tool] branch master updated: Make the indicator builder to know how to deserialize the complex dat… (#9)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking-oal-tool.git
The following commit(s) were added to refs/heads/master by this push:
new 1746e34 Make the indicator builder to know how to deserialize the complex dat… (#9)
1746e34 is described below
commit 1746e34bc5cf5228d5898cf6cce2107ca912a438
Author: 彭勇升 pengys <80...@qq.com>
AuthorDate: Thu Sep 20 15:23:09 2018 +0800
Make the indicator builder to know how to deserialize the complex dat… (#9)
* Make the indicator builder to know how to deserialize the complex data type.
* Separate String types from complex types.
---
.../oap/server/core/analysis/indicator/IntKeyLongValueArray.java | 2 +-
.../src/main/resources/code-templates/IndicatorImplementor.ftl | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/IntKeyLongValueArray.java b/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/IntKeyLongValueArray.java
index 30a957b..ed7c60d 100644
--- a/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/IntKeyLongValueArray.java
+++ b/oal-parser/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/IntKeyLongValueArray.java
@@ -29,7 +29,7 @@ public class IntKeyLongValueArray extends ArrayList<IntKeyLongValue> {
super(initialCapacity);
}
- public IntKeyLongValueArray() {
+ public IntKeyLongValueArray(String data) {
super();
}
}
diff --git a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
index 0364a74..3aa9747 100644
--- a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
+++ b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
@@ -229,15 +229,19 @@ public class ${metricName}Indicator extends ${indicatorClassName} implements Ala
<#list fieldsFromSource as field>
<#if field.typeName == "long" || field.typeName == "int" || field.typeName == "double" || field.typeName == "float">
indicator.${field.fieldSetter}(((Number)dbMap.get("${field.columnName}")).${field.typeName}Value());
- <#else>
+ <#elseif field.typeName == "java.lang.String" || field.typeName == "String">
indicator.${field.fieldSetter}((${field.typeName})dbMap.get("${field.columnName}"));
+ <#else>
+ indicator.${field.fieldSetter}(new ${field.typeName}((String)dbMap.get("${field.columnName}")));
</#if>
</#list>
<#list persistentFields as field>
<#if field.typeName == "long" || field.typeName == "int" || field.typeName == "double" || field.typeName == "float">
indicator.${field.fieldSetter}(((Number)dbMap.get("${field.columnName}")).${field.typeName}Value());
- <#else>
+ <#elseif field.typeName == "java.lang.String" || field.typeName == "String">
indicator.${field.fieldSetter}((${field.typeName})dbMap.get("${field.columnName}"));
+ <#else>
+ indicator.${field.fieldSetter}(new ${field.typeName}((String)dbMap.get("${field.columnName}")));
</#if>
</#list>
return indicator;