|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sonar.api.measures.Metric.Builder
public static final class Metric.Builder
Metric.Builder is used to create metric definitions. It must be preferred to creating new instances of the Metric class directly.
| Constructor Summary | |
|---|---|
Metric.Builder(String key,
String name,
Metric.ValueType type)
Creates a new Metric.Builder object. |
|
| Method Summary | ||
|---|---|---|
|
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). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
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 type| Method Detail |
|---|
public Metric.Builder setDescription(String d)
d - the description
public Metric.Builder setDirection(Integer d)
d - the direction
Metric.DIRECTION_WORST,
Metric.DIRECTION_BETTER,
Metric.DIRECTION_NONEpublic Metric.Builder setQualitative(Boolean b)
b - Boolean.TRUE if the metric is qualitative
public Metric.Builder setDomain(String d)
d - the domain
public Metric.Builder setFormula(Formula f)
f - the formula
SumChildDistributionFormula,
SumChildValuesFormula,
MeanAggregationFormula,
WeightedMeanAggregationFormulapublic Metric.Builder setWorstValue(Double d)
d - the worst value
public Metric.Builder setBestValue(Double d)
d - the best value
public 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 value
public 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.
public <G extends Serializable> Metric<G> create()
Metric object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||