本文整理汇总了Java中org.sonar.api.measures.Metric.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Metric.getType方法的具体用法?Java Metric.getType怎么用?Java Metric.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sonar.api.measures.Metric
的用法示例。
在下文中一共展示了Metric.getType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import org.sonar.api.measures.Metric; //导入方法依赖的package包/类
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
if (source == null) {
sb.append("Report Measures: ");
} else {
sb.append("File ").append(source.toString()).append(" Measures: \n");
}
for (Measure measure : ctcMeasures) {
Metric metric = measure.getMetric();
sb.append(" Metric: ").append(metric.getName()).append("\n Value: ");
switch (metric.getType()) {
case DATA:
sb.append(measure.getData());
break;
case FLOAT:
sb.append(measure.getValue());
break;
case INT:
sb.append(measure.getIntValue());
break;
case MILLISEC:
break;
case PERCENT:
default:
sb.append(measure.toString());
break;
}
sb.append("\n");
}
return sb.toString();
}
示例2: isADouble
import org.sonar.api.measures.Metric; //导入方法依赖的package包/类
private static boolean isADouble(Metric metric) {
return metric.getType() == Metric.ValueType.FLOAT ||
metric.getType() == Metric.ValueType.PERCENT ||
metric.getType() == Metric.ValueType.RATING;
}
示例3: isAInteger
import org.sonar.api.measures.Metric; //导入方法依赖的package包/类
private static boolean isAInteger(Metric metric) {
return metric.getType() == Metric.ValueType.INT ||
metric.getType() == Metric.ValueType.MILLISEC;
}
示例4: isAString
import org.sonar.api.measures.Metric; //导入方法依赖的package包/类
private static boolean isAString(Metric metric) {
return metric.getType() == Metric.ValueType.STRING ||
metric.getType() == Metric.ValueType.LEVEL;
}
示例5: isABoolean
import org.sonar.api.measures.Metric; //导入方法依赖的package包/类
private static boolean isABoolean(Metric metric) {
return metric.getType() == Metric.ValueType.BOOL;
}