public static final class Metric.Builder extends Object
| Constructor and Description |
|---|
Metric.Builder(String key,
String name,
Metric.ValueType type)
Creates a new
Metric.Builder object. |
| Modifier and Type | Method and Description |
|---|---|
Metric |
create()
Creates a new metric definition based on the properties set on this metric builder.
|
Metric.Builder |
setBestValue(Double d)
Sets the best value that the metric can get (example: 100.0 for code coverage).
|
Metric.Builder |
setDeleteHistoricalData(boolean b)
Specifies whether measures from the past can be automatically deleted to minimize database volume.
|
Metric.Builder |
setDescription(String d)
Sets the metric description.
|
Metric.Builder |
setDirection(Integer d)
Sets the metric direction (used for numeric values only), which is used in the Web UI to show if the trend of a metric is good or not.
|
Metric.Builder |
setDomain(String d)
Sets the domain for the metric (General, Complexity...).
|
Metric.Builder |
setFormula(Formula f)
Specifies the formula used by Sonar to automatically aggregate measures stored on files up to the project level.
|
Metric.Builder |
setHidden(boolean b)
Sets whether the metric should be hidden in Web UI (e.g.
|
Metric.Builder |
setOptimizedBestValue(boolean b)
Specifies whether file-level measures that equal to the defined best value are stored or not.
|
Metric.Builder |
setQualitative(Boolean b)
Sets whether the metric is qualitative or not.
|
Metric.Builder |
setUserManaged(boolean b)
Specifies whether this metric can be edited online in the "Manual measures" page.
|
Metric.Builder |
setWorstValue(Double d)
Sets the worst value that the metric can get (example: 0.0 for code coverage).
|
public Metric.Builder(String key, String name, Metric.ValueType type)
Metric.Builder object.key - the metric key, should be unique among all metricsname - the metric nametype - the metric typepublic Metric.Builder setDescription(String d)
d - the descriptionpublic Metric.Builder setDirection(Integer d)
d - the directionMetric.DIRECTION_WORST,
Metric.DIRECTION_BETTER,
Metric.DIRECTION_NONEpublic Metric.Builder setQualitative(Boolean b)
b - Boolean.TRUE if the metric is qualitativepublic Metric.Builder setDomain(String d)
d - the domainpublic Metric.Builder setFormula(Formula f)
f - the formulaSumChildDistributionFormula}, {@link SumChildValuesFormula}, {@link AverageComplexityFormula}, {@link MeanAggregationFormula},
{@link WeightedMeanAggregationFormula}public Metric.Builder setWorstValue(Double d)
d - the worst valuepublic Metric.Builder setBestValue(Double d)
d - the best valuepublic Metric.Builder setOptimizedBestValue(boolean b)
CoreMetrics.VIOLATIONS):
if a file has no violation, then the value '0' won't be stored in the database.b - true if the measures must not be stored when they equal to the best valuepublic Metric.Builder setHidden(boolean b)
b - true if the metric should be hidden.public Metric.Builder setUserManaged(boolean b)
b - true if the metric can be edited online.public Metric.Builder setDeleteHistoricalData(boolean b)
b - true if measures from the past can be deleted automatically.Copyright © 2009-2012 SonarSource. All Rights Reserved.