本文整理了Java中org.sonar.api.measures.Metric.<init>()
方法的一些代码示例,展示了Metric.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metric.<init>()
方法的具体详情如下:
包路径:org.sonar.api.measures.Metric
类名称:Metric
方法名:<init>
[英]Creates an empty metric
[中]创建一个空度量
代码示例来源:origin: SonarSource/sonarqube
/**
* Creates a new metric definition based on the properties set on this metric builder.
*
* @return a new {@link Metric} object
*/
public <G extends Serializable> Metric<G> create() {
if (ValueType.PERCENT == this.type) {
this.bestValue = (direction == DIRECTION_BETTER) ? 100.0 : 0.0;
this.worstValue = (direction == DIRECTION_BETTER) ? 0.0 : 100.0;
this.decimalScale = firstNonNull(decimalScale, DEFAULT_DECIMAL_SCALE);
} else if (ValueType.FLOAT == this.type) {
this.decimalScale = firstNonNull(decimalScale, DEFAULT_DECIMAL_SCALE);
}
return new Metric<>(this);
}
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public Metric apply(@Nonnull MetricDto dto) {
Metric<Serializable> metric = new Metric<>();
metric.setId(dto.getId());
metric.setKey(dto.getKey());
metric.setDescription(dto.getDescription());
metric.setName(dto.getShortName());
metric.setBestValue(dto.getBestValue());
metric.setDomain(dto.getDomain());
metric.setEnabled(dto.isEnabled());
metric.setDirection(dto.getDirection());
metric.setHidden(dto.isHidden());
metric.setQualitative(dto.isQualitative());
metric.setType(Metric.ValueType.valueOf(dto.getValueType()));
metric.setOptimizedBestValue(dto.isOptimizedBestValue());
metric.setUserManaged(dto.isUserManaged());
metric.setWorstValue(dto.getWorstValue());
return metric;
}
}
代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api
/**
* Creates a new metric definition based on the properties set on this metric builder.
*
* @return a new {@link Metric} object
*/
public <G extends Serializable> Metric<G> create() {
if (ValueType.PERCENT.equals(this.type)) {
this.bestValue = (direction == DIRECTION_BETTER ? 100.0 : 0.0);
this.worstValue = (direction == DIRECTION_BETTER ? 0.0 : 100.0);
}
return new Metric<G>(this);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch
private Map loadData(String metricKey, Converter converter) {
// FIXME no way to load measure only by key
Measure measure = index.getMeasure(resource, new Metric(metricKey));
String data = measure != null ? measure.getData() : null;
if (data != null) {
return ImmutableMap.copyOf(KeyValueFormat.parse(data, KeyValueFormat.newIntegerConverter(), converter));
}
// no such measure
return ImmutableMap.of();
}
代码示例来源:origin: org.codehaus.sonar/sonar-batch
private Map loadData(String metricKey, Converter converter) {
// FIXME no way to load measure only by key
Measure measure = index.getMeasure(resource, new Metric(metricKey));
String data = measure != null ? measure.getData() : null;
if (data != null) {
return ImmutableMap.copyOf(KeyValueFormat.parse(data, KeyValueFormat.newIntegerConverter(), converter));
}
// no such measure
return ImmutableMap.of();
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-plugin-api
/**
* Creates a new metric definition based on the properties set on this metric builder.
*
* @return a new {@link Metric} object
*/
public <G extends Serializable> Metric<G> create() {
if (ValueType.PERCENT == this.type) {
this.bestValue = (direction == DIRECTION_BETTER) ? 100.0 : 0.0;
this.worstValue = (direction == DIRECTION_BETTER) ? 0.0 : 100.0;
this.decimalScale = firstNonNull(decimalScale, DEFAULT_DECIMAL_SCALE);
} else if (ValueType.FLOAT == this.type) {
this.decimalScale = firstNonNull(decimalScale, DEFAULT_DECIMAL_SCALE);
}
return new Metric<>(this);
}
}
代码示例来源:origin: stackoverflow.com
Metric metric = new Metric();
metric.setGenerationTime("etc");
metric.setPublishedBy("author");
metric.setParent("parent");
boolean exists = entityManager.find(Metric.class, metric) != null;
代码示例来源:origin: org.sonarsource.sonarqube/sonar-server
@Override
public Metric apply(@Nonnull MetricDto dto) {
Metric<Serializable> metric = new Metric<>();
metric.setId(dto.getId());
metric.setKey(dto.getKey());
metric.setDescription(dto.getDescription());
metric.setName(dto.getShortName());
metric.setBestValue(dto.getBestValue());
metric.setDomain(dto.getDomain());
metric.setEnabled(dto.isEnabled());
metric.setDirection(dto.getDirection());
metric.setHidden(dto.isHidden());
metric.setQualitative(dto.isQualitative());
metric.setType(Metric.ValueType.valueOf(dto.getValueType()));
metric.setOptimizedBestValue(dto.isOptimizedBestValue());
metric.setUserManaged(dto.isUserManaged());
metric.setWorstValue(dto.getWorstValue());
return metric;
}
}
内容来源于网络,如有侵权,请联系作者删除!