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:40:26 UTC
[incubator-skywalking-oal-tool] branch master updated: Format all
type to full type name.
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 e993a9e Format all type to full type name.
e993a9e is described below
commit e993a9e2980cbc1f910460f7a8b0f6db08a69d7f
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Sep 20 15:40:18 2018 +0800
Format all type to full type name.
---
.../apache/skywalking/oal/tool/parser/SourceColumn.java | 2 +-
.../main/resources/code-templates/IndicatorImplementor.ftl | 14 +++++++-------
.../expectedFiles/IndicatorImplementorExpected.java | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/oal-parser/src/main/java/org/apache/skywalking/oal/tool/parser/SourceColumn.java b/oal-parser/src/main/java/org/apache/skywalking/oal/tool/parser/SourceColumn.java
index 604cbe0..2339ba1 100644
--- a/oal-parser/src/main/java/org/apache/skywalking/oal/tool/parser/SourceColumn.java
+++ b/oal-parser/src/main/java/org/apache/skywalking/oal/tool/parser/SourceColumn.java
@@ -38,7 +38,7 @@ public class SourceColumn {
this.fieldName = fieldName;
this.columnName = columnName;
this.type = type;
- this.typeName = type.getSimpleName();
+ this.typeName = type.getName();
this.isID = isID;
this.fieldGetter = ClassMethodUtil.toGetMethod(fieldName);
diff --git a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
index 3aa9747..0e2db23 100644
--- a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
+++ b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
@@ -56,7 +56,7 @@ public class ${metricName}Indicator extends ${indicatorClassName} implements Ala
String splitJointId = String.valueOf(getTimeBucket());
<#list fieldsFromSource as sourceField>
<#if sourceField.isID()>
- <#if sourceField.getTypeName() == "String">
+ <#if sourceField.getTypeName() == "java.lang.String">
splitJointId += Const.ID_SPLIT + ${sourceField.fieldName};
<#else>
splitJointId += Const.ID_SPLIT + String.valueOf(${sourceField.fieldName});
@@ -70,7 +70,7 @@ public class ${metricName}Indicator extends ${indicatorClassName} implements Ala
int result = 17;
<#list fieldsFromSource as sourceField>
<#if sourceField.isID()>
- <#if sourceField.getTypeName() == "String">
+ <#if sourceField.getTypeName() == "java.lang.String">
result = 31 * result + ${sourceField.fieldName}.hashCode();
<#else>
result += Const.ID_SPLIT + ${sourceField.fieldName};
@@ -86,7 +86,7 @@ public class ${metricName}Indicator extends ${indicatorClassName} implements Ala
int result = 17;
<#list fieldsFromSource as sourceField>
<#if sourceField.isID()>
- <#if sourceField.getTypeName() == "String">
+ <#if sourceField.getTypeName() == "java.lang.String">
result = 31 * result + ${sourceField.fieldName}.hashCode();
<#else>
result += Const.ID_SPLIT + ${sourceField.fieldName};
@@ -229,8 +229,8 @@ 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());
- <#elseif field.typeName == "java.lang.String" || field.typeName == "String">
- indicator.${field.fieldSetter}((${field.typeName})dbMap.get("${field.columnName}"));
+ <#elseif field.typeName == "java.lang.String">
+ indicator.${field.fieldSetter}((String)dbMap.get("${field.columnName}"));
<#else>
indicator.${field.fieldSetter}(new ${field.typeName}((String)dbMap.get("${field.columnName}")));
</#if>
@@ -238,8 +238,8 @@ public class ${metricName}Indicator extends ${indicatorClassName} implements Ala
<#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());
- <#elseif field.typeName == "java.lang.String" || field.typeName == "String">
- indicator.${field.fieldSetter}((${field.typeName})dbMap.get("${field.columnName}"));
+ <#elseif field.typeName == "java.lang.String">
+ indicator.${field.fieldSetter}((String)dbMap.get("${field.columnName}"));
<#else>
indicator.${field.fieldSetter}(new ${field.typeName}((String)dbMap.get("${field.columnName}")));
</#if>
diff --git a/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java b/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
index f01fe75..a7a4574 100644
--- a/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
+++ b/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
@@ -41,7 +41,7 @@ import org.apache.skywalking.oap.server.core.source.Scope;
@StorageEntity(name = "service_avg", builder = ServiceAvgIndicator.Builder.class)
public class ServiceAvgIndicator extends LongAvgIndicator implements AlarmSupported {
- @Setter @Getter @Column(columnName = "entity_id") @IDColumn private String entityId;
+ @Setter @Getter @Column(columnName = "entity_id") @IDColumn private java.lang.String entityId;
@Override public String id() {
String splitJointId = String.valueOf(getTimeBucket());
@@ -173,7 +173,7 @@ public class ServiceAvgIndicator extends LongAvgIndicator implements AlarmSuppor
indicator.setCount(((Number)dbMap.get("count")).intValue());
indicator.setValue(((Number)dbMap.get("value")).longValue());
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
- indicator.setStringField((java.lang.String)dbMap.get("string_field"));
+ indicator.setStringField((String)dbMap.get("string_field"));
return indicator;
}
}