org.sonar.api.measures
Class Metric.Builder

java.lang.Object
  extended by org.sonar.api.measures.Metric.Builder
Enclosing class:
Metric

public static final class Metric.Builder
extends Object

Since:
2.7

Constructor Summary
Metric.Builder(String key, String name, Metric.ValueType type)
           
 
Method Summary
 Metric create()
           
 Metric.Builder setBestValue(Double d)
          Sets the best value.
 Metric.Builder setDescription(String s)
          Sets the metric description.
 Metric.Builder setDirection(Integer i)
          Sets the metric direction.
 Metric.Builder setDomain(String s)
          Sets the domain for the metric (General, Complexity...).
 Metric.Builder setFormula(Formula f)
           
 Metric.Builder setHidden(boolean b)
          Sets whether the metric should be hidden in UI (e.g.
 Metric.Builder setOptimizedBestValue(boolean b)
           
 Metric.Builder setQualitative(Boolean b)
          Sets whether the metric is qualitative.
 Metric.Builder setWorstValue(Double d)
          Sets the worst value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Metric.Builder

public Metric.Builder(String key,
                      String name,
                      Metric.ValueType type)
Parameters:
key - the metric key, should be unique among all metrics
name - the metric name
type - the metric type
Method Detail

setDescription

public Metric.Builder setDescription(String s)
Sets the metric description.


setDirection

public Metric.Builder setDirection(Integer i)
Sets the metric direction. Used for numeric values only.

See Also:
Metric.DIRECTION_WORST, Metric.DIRECTION_BETTER, Metric.DIRECTION_NONE

setQualitative

public Metric.Builder setQualitative(Boolean b)
Sets whether the metric is qualitative.


setDomain

public Metric.Builder setDomain(String s)
Sets the domain for the metric (General, Complexity...).


setFormula

public Metric.Builder setFormula(Formula f)

setWorstValue

public Metric.Builder setWorstValue(Double d)
Sets the worst value.


setBestValue

public Metric.Builder setBestValue(Double d)
Sets the best value. Resources would be hidden on drilldown page, if value of measure equal to best value.


setOptimizedBestValue

public Metric.Builder setOptimizedBestValue(boolean b)

setHidden

public Metric.Builder setHidden(boolean b)
Sets whether the metric should be hidden in UI (e.g. in Time Machine).


create

public Metric create()


Copyright © 2009-2011 SonarSource. All Rights Reserved.