public static final class Metric.Builder extends Object
| Constructor and Description | 
|---|
| Builder(String key,
       String name,
       Metric.ValueType type)Creates a new  Metric.Builderobject. | 
| Modifier and Type | Method and Description | 
|---|---|
| <G extends Serializable> | 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 | setDecimalScale(int scale)Scale to be used if the metric has decimal type ( Metric.ValueType.FLOATorMetric.ValueType.PERCENT). | 
| 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)Deprecated. 
 since 5.2, it's no more possible to define a formula on a metric, please use  MeasureComputerinstead | 
| 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 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 domain@Deprecated public Metric.Builder setFormula(Formula f)
MeasureComputer insteadf - the formulapublic 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.public Metric.Builder setDecimalScale(int scale)
Metric.ValueType.FLOAT or Metric.ValueType.PERCENT).
 Default is 1. It is not set ((null) on non-decimal metrics.public <G extends Serializable> Metric<G> create()
Metric objectCopyright © 2009–2016 SonarSource. All rights reserved.