提交 04041ebd 编写于 作者: wu-sheng's avatar wu-sheng

Remove the “get” method of String/Boolean/Integer Tags.

上级 c2319bcc
......@@ -30,6 +30,4 @@ public abstract class AbstractTag<T> {
public String key() {
return this.key;
}
public abstract T get(Span span);
}
......@@ -21,20 +21,7 @@ public class BooleanTag extends AbstractTag<Boolean> {
span.setTag(key, tagValue);
}
/**
* Get a tag value, type of {@link Boolean}. After akka-message/serialize, all tags values are type of {@link
* String}, convert to {@link Boolean}, if necessary.
*
* @param span
* @return tag value
*/
@Override
public Boolean get(Span span) {
Boolean tagValue = span.getBoolTag(super.key);
if (tagValue == null) {
return defaultValue;
} else {
return tagValue;
}
public boolean defaultValue() {
return this.defaultValue;
}
}
......@@ -16,21 +16,4 @@ public class IntTag extends AbstractTag<Integer> {
public void set(Span span, Integer tagValue) {
span.setTag(super.key, tagValue);
}
/**
* Get a tag value, type of {@link Integer}. After akka-message/serialize, all tags values are type of {@link
* String}, convert to {@link Integer}, if necessary.
*
* @param span
* @return tag value
*/
@Override
public Integer get(Span span) {
Integer tagValue = span.getIntTag(super.key);
if (tagValue == null) {
return null;
} else {
return tagValue;
}
}
}
......@@ -17,9 +17,4 @@ public class StringTag extends AbstractTag<String> {
public void set(Span span, String tagValue) {
span.setTag(key, tagValue);
}
@Override
public String get(Span span) {
return span.getStrTag(super.key);
}
}
......@@ -10,6 +10,11 @@ import org.skywalking.apm.trace.tag.BooleanTag;
*/
public class BooleanTagGetter {
public static Boolean get(Span span, BooleanTag tag) {
return span.getBoolTag(tag.key());
Boolean tagValue = span.getBoolTag(tag.key());
if (tagValue == null) {
return tag.defaultValue();
} else {
return tagValue;
}
}
}
......@@ -10,6 +10,11 @@ import org.skywalking.apm.trace.tag.IntTag;
*/
public class IntTagGetter {
public static Integer get(Span span, IntTag tag) {
return span.getIntTag(tag.key());
Integer tagValue = span.getIntTag(tag.key());
if (tagValue == null) {
return null;
} else {
return tagValue;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册