org.sonar.api.measures.Metric.getId()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.sonar.api.measures.Metric.getId()方法的一些代码示例,展示了Metric.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metric.getId()方法的具体详情如下:
包路径:org.sonar.api.measures.Metric
类名称:Metric
方法名:getId

Metric.getId介绍

[英]For internal use only
[中]仅供内部使用

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Test
public void shouldCreateMetricWithDefaultValues() {
 Metric metric = new Metric.Builder("foo", "Foo", Metric.ValueType.INT)
  .create();
 assertThat(metric.getBestValue()).isNull();
 assertThat(metric.getDescription()).isNull();
 assertThat(metric.getWorstValue()).isNull();
 assertThat(metric.getDirection()).isEqualTo(Metric.DIRECTION_NONE);
 assertThat(metric.getEnabled()).isTrue();
 assertThat(metric.getId()).isNull();
 assertThat(metric.getUserManaged()).isFalse();
 assertThat(metric.isHidden()).isFalse();
 assertThat(metric.isOptimizedBestValue()).isFalse();
}

代码示例来源:origin: SonarSource/sonarqube

@Override
 @Nonnull
 public MetricDto apply(@Nonnull Metric metric) {
  MetricDto dto = new MetricDto();
  dto.setId(metric.getId());
  dto.setKey(metric.getKey());
  dto.setDescription(metric.getDescription());
  dto.setShortName(metric.getName());
  dto.setBestValue(metric.getBestValue());
  dto.setDomain(metric.getDomain());
  dto.setEnabled(metric.getEnabled());
  dto.setDirection(metric.getDirection());
  dto.setHidden(metric.isHidden());
  dto.setQualitative(metric.getQualitative());
  dto.setValueType(metric.getType().name());
  dto.setOptimizedBestValue(metric.isOptimizedBestValue());
  dto.setUserManaged(metric.getUserManaged());
  dto.setWorstValue(metric.getWorstValue());
  dto.setDeleteHistoricalData(metric.getDeleteHistoricalData());
  dto.setDecimalScale(metric.getDecimalScale());
  return dto;
 }
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

PastMeasuresLoader(DatabaseSession session, Collection<Metric> metrics) {
 this.session = session;
 this.metricByIds = Maps.newHashMap();
 for (Metric metric : metrics) {
  if (metric.isNumericType()) {
   metricByIds.put(metric.getId(), metric);
  }
 }
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

public Map<Integer, Metric> getMetricsById(TimeMachineQuery query) {
 Collection<Metric> metrics = metricFinder.findAll(query.getMetricKeys());
 Map<Integer, Metric> result = Maps.newHashMap();
 for (Metric metric : metrics) {
  result.put(metric.getId(), metric);
 }
 return result;
}

代码示例来源:origin: stackoverflow.com

long start = end - (8 * 60 * 60 * 1000);
MetricDataResponse dataResponse = api.getMetricData(m.getId(),
                            start, end);
hqAssertSuccess(dataResponse);

代码示例来源:origin: org.codehaus.sonar.plugins/sonar-core-plugin

Integer metricId = measure.getMetric().getId();
if (metricId == null) {
 Metric metric = metricFinder.findByKey(measure.getMetric().getKey());
  throw new IllegalStateException("Unknow metric with key: " + measure.getMetric().getKey());
 metricId = metric.getId();

代码示例来源:origin: org.sonarsource.sonarqube/sonar-server

@Override
 @Nonnull
 public MetricDto apply(@Nonnull Metric metric) {
  MetricDto dto = new MetricDto();
  dto.setId(metric.getId());
  dto.setKey(metric.getKey());
  dto.setDescription(metric.getDescription());
  dto.setShortName(metric.getName());
  dto.setBestValue(metric.getBestValue());
  dto.setDomain(metric.getDomain());
  dto.setEnabled(metric.getEnabled());
  dto.setDirection(metric.getDirection());
  dto.setHidden(metric.isHidden());
  dto.setQualitative(metric.getQualitative());
  dto.setValueType(metric.getType().name());
  dto.setOptimizedBestValue(metric.isOptimizedBestValue());
  dto.setUserManaged(metric.getUserManaged());
  dto.setWorstValue(metric.getWorstValue());
  dto.setDeleteHistoricalData(metric.getDeleteHistoricalData());
  dto.setDecimalScale(metric.getDecimalScale());
  return dto;
 }
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

static MeasureModel model(Measure measure, RuleFinder ruleFinder) {
 MeasureModel model = new MeasureModel();
 model.setMetricId(measure.getMetric().getId());
 model.setDescription(measure.getDescription());
 model.setData(measure.getData());

相关文章