public class Measure<G extends Serializable> extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected Metric.Level |
alertStatus |
protected String |
alertText |
protected Characteristic |
characteristic |
protected String |
data |
protected Date |
date |
static int |
DEFAULT_PRECISION
Default precision when saving a float type metric
|
protected String |
description |
protected static int |
MAX_TEXT_SIZE |
protected Metric<G> |
metric |
protected String |
metricKey |
protected PersistenceMode |
persistenceMode |
protected Integer |
personId |
protected Requirement |
requirement |
protected String |
url |
protected Double |
value |
protected Double |
variation1 |
protected Double |
variation2 |
protected Double |
variation3 |
protected Double |
variation4 |
protected Double |
variation5 |
Constructor and Description |
---|
Measure()
Creates an empty measure
|
Measure(Metric metric)
Creates a measure with a metric
|
Measure(Metric metric,
Double value)
Creates a measure with a metric and a value
|
Measure(Metric metric,
Double value,
int precision)
Creates a measure with a metric, a value and a precision for the value
|
Measure(Metric metric,
Double value,
String data)
Creates a measure with a metric, a value and a data field
|
Measure(Metric metric,
Metric.Level level)
Creates a measure with a metric and an alert level
|
Measure(Metric metric,
String data)
* Creates a measure with a metric and a data field
|
Measure(String metricKey) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
Metric.Level |
getAlertStatus() |
String |
getAlertText() |
Characteristic |
getCharacteristic() |
String |
getData() |
Metric.Level |
getDataAsLevel() |
Date |
getDate() |
String |
getDescription() |
Integer |
getIntValue() |
Metric<G> |
getMetric() |
String |
getMetricKey() |
PersistenceMode |
getPersistenceMode()
Gets the persistence mode of the measure.
|
Integer |
getPersonId() |
Requirement |
getRequirement()
Deprecated.
since 4.3.
|
Integer |
getTendency()
Deprecated.
since 5.2. See https://jira.sonarsource.com/browse/SONAR-6392
|
String |
getUrl() |
Double |
getValue() |
Double |
getVariation(int index) |
Double |
getVariation1() |
Double |
getVariation2() |
Double |
getVariation3() |
Double |
getVariation4() |
Double |
getVariation5() |
boolean |
hasData() |
int |
hashCode() |
boolean |
isBestValue() |
boolean |
isFromCore()
For internal use
|
Measure<G> |
setAlertStatus(Metric.Level status)
Set the alert status of the measure
|
Measure<G> |
setAlertText(String alertText)
Sets the text associated to the alert on the measure
|
Measure<G> |
setCharacteristic(Characteristic characteristic) |
Measure<G> |
setData(Metric.Level level)
Sets an alert level as the data field
|
Measure<G> |
setData(String s)
Sets the data field of the measure.
|
Measure<G> |
setDate(Date date)
Sets the date of the measure - Used only in TimeMachine queries
|
Measure<G> |
setDescription(String description)
Sets the measure description
|
void |
setFromCore(boolean fromCore)
For internal use
|
Measure<G> |
setId(Long id)
Deprecated.
since 4.4 not used
|
Measure<G> |
setIntValue(Integer i)
Sets the measure value as an int
|
Measure<G> |
setMetric(Metric<G> metric)
Set the underlying metric
|
Measure<G> |
setPersistenceMode(PersistenceMode mode)
Sets the persistence mode of a measure.
|
Measure<G> |
setPersonId(Integer i) |
Measure<G> |
setRawValue(Double v)
For internal use
|
Measure<G> |
setRequirement(Requirement requirement)
Deprecated.
since 4.3
|
Measure<G> |
setTendency(Integer tendency)
Deprecated.
since 5.2. See https://jira.sonarsource.com/browse/SONAR-6392
|
Measure<G> |
setUrl(String url)
Sets the URL of the measure
|
Measure<G> |
setValue(Double v)
Sets the measure value with the default precision of 1
|
Measure<G> |
setValue(Double v,
int precision)
Sets the measure value with a given precision
|
Measure<G> |
setVariation(int index,
Double d)
Internal use only
|
Measure<G> |
setVariation1(Double d)
Internal use only
|
Measure<G> |
setVariation2(Double d)
Internal use only
|
Measure<G> |
setVariation3(Double d)
Internal use only
|
Measure<G> |
setVariation4(Double d)
Internal use only
|
Measure<G> |
setVariation5(Double d)
Internal use only
|
String |
toString() |
Measure<G> |
unsetData() |
G |
value()
For internal use.
|
protected static final int MAX_TEXT_SIZE
public static final int DEFAULT_PRECISION
protected Metric<G extends Serializable> metric
protected String description
protected Metric.Level alertStatus
protected Double variation1
protected Double variation2
protected Double variation3
protected Double variation4
protected Double variation5
protected Characteristic characteristic
protected Requirement requirement
protected PersistenceMode persistenceMode
public Measure(Metric metric)
metric
- the metricpublic Measure(Metric metric, Double value)
metric
- the metricvalue
- its valuepublic Measure(Metric metric, Double value, int precision)
metric
- the metricvalue
- its valueprecision
- the value precisionpublic Measure(Metric metric, Double value, String data)
metric
- the metricvalue
- the valuedata
- the data fieldpublic Measure(Metric metric, String data)
metric
- the metricdata
- the data fieldpublic Measure(Metric metric, Metric.Level level)
metric
- the metriclevel
- the alert levelpublic Measure()
public PersistenceMode getPersistenceMode()
public Measure<G> setPersistenceMode(@Nullable PersistenceMode mode)
Sets the persistence mode of a measure.
WARNING : Being able to reuse measures saved in memory is only possible within the same tree. In a multi-module project for example, a measure save in memory at the module level will not be accessible by the root project. In that case, database should be used.
mode
- the modepublic String getMetricKey()
public Measure<G> setMetric(Metric<G> metric)
metric
- the metricpublic Metric.Level getDataAsLevel()
public boolean hasData()
public Date getDate()
public Measure<G> setDate(Date date)
date
- the date@CheckForNull public Double getValue()
public Integer getIntValue()
public Measure<G> setValue(@Nullable Double v)
v
- the measure valuepublic Measure<G> setRawValue(@Nullable Double v)
public Measure<G> setIntValue(Integer i)
i
- the valuepublic Measure<G> setValue(@Nullable Double v, int precision)
v
- the measure valueprecision
- the measure value precision@CheckForNull public String getData()
public Measure<G> setData(String s)
s
- the datapublic Measure<G> setData(Metric.Level level)
level
- the alert levelpublic String getDescription()
public Measure<G> setDescription(String description)
description
- the descriptionpublic Metric.Level getAlertStatus()
public Measure<G> setAlertStatus(@Nullable Metric.Level status)
status
- the statuspublic String getAlertText()
public Measure<G> setAlertText(@Nullable String alertText)
alertText
- the text@Deprecated @CheckForNull public Integer getTendency()
null
since version 5.2@Deprecated public Measure<G> setTendency(@Nullable Integer tendency)
@Deprecated public Measure<G> setId(Long id)
public Double getVariation1()
public Measure<G> setVariation1(@Nullable Double d)
public Double getVariation2()
public Measure<G> setVariation2(@Nullable Double d)
public Double getVariation3()
public Measure<G> setVariation3(@Nullable Double d)
public Double getVariation4()
public Measure<G> setVariation4(@Nullable Double d)
public Double getVariation5()
public Measure<G> setVariation5(@Nullable Double d)
public Double getVariation(int index)
public Measure<G> setVariation(int index, Double d)
public Measure<G> setUrl(String url)
url
- the url@CheckForNull public final Characteristic getCharacteristic()
public final Measure<G> setCharacteristic(@Nullable Characteristic characteristic)
@Deprecated @CheckForNull public final Requirement getRequirement()
@Deprecated public final Measure<G> setRequirement(@Nullable Requirement requirement)
@CheckForNull @Beta public Integer getPersonId()
@Beta public Measure<G> setPersonId(@Nullable Integer i)
public boolean isBestValue()
public boolean isFromCore()
public void setFromCore(boolean fromCore)
Copyright © 2009–2015 SonarSource. All rights reserved.