wu-sheng closed pull request #9: Make the indicator builder to know how to deserialize the complex dat… URL: https://github.com/apache/incubator-skywalking-oal-tool/pull/9
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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 IntKeyLongValueArray(int initialCapacity) { 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; ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services