T
- the value typepublic class Metric<T extends Number> extends Object
Constructor and Description |
---|
Metric(String name,
T value)
Create a new
Metric instance for the current time. |
Metric(String name,
T value,
Date timestamp)
Create a new
Metric instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getName()
Returns the name of the metric.
|
Date |
getTimestamp() |
T |
getValue()
Returns the value of the metric.
|
int |
hashCode() |
Metric<Long> |
increment(int amount)
Create a new
Metric with an incremented value. |
<S extends Number> |
set(S value)
Create a new
Metric with a different value. |
String |
toString() |
public Metric(String name, T value)
Metric
instance for the current time.name
- the name of the metricvalue
- the value of the metricpublic String getName()
public T getValue()
public Date getTimestamp()
public Metric<Long> increment(int amount)
Metric
with an incremented value.amount
- the amount that the new metric will differ from this oneMetric
instancepublic <S extends Number> Metric<S> set(S value)
Metric
with a different value.S
- the metric value typevalue
- the value of the new metricMetric
instanceCopyright © 2015 Pivotal Software, Inc.. All rights reserved.