public class MetricValue
extends java.lang.Object
name
,
making indexing possible and the data value
can be anything. The receiving algorithm
should be able to properly interpret the data object and there is a data type
to help with this. In some cases the name or type can be null, if this class is used as
a container for a value only.Modifier | Constructor and Description |
---|---|
protected |
MetricValue(java.lang.String thisValueName,
java.lang.String thisValueType,
java.lang.Object thisObjValue)
Create a new instance of MetricValue.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Get the id or name of this value structure.
|
java.lang.Object |
getValue()
Get the object value.
|
java.lang.String |
getValueType()
Get the type of the object value.
|
void |
setName(java.lang.String thisName)
Set the id or name of this data value.
|
void |
setValue(java.lang.Object thisObjValue)
Set the object value.
|
MetricDataset |
toDataset()
Create a new dataset, with this object value as a single value in it, or return this value
if it is already a
MetricDataset . |
java.lang.String |
toString()
Get a String-based representation of this metric value object.
|
static MetricValue |
toValue()
Create an empty metric value object to be filled in later.
|
static MetricValue |
toValue(java.lang.Object dataPoint)
Create a metric value object that stores the single data point as is.
|
static MetricValue |
toValue(java.lang.String name,
java.lang.String valueType,
java.lang.Object dataPoint)
Create a metric value object that stores the single data point as is.
|
protected MetricValue(java.lang.String thisValueName, java.lang.String thisValueType, java.lang.Object thisObjValue)
thisValueName
- a unique name for the value point. Can be null if not used.thisValueType
- the type of value that is stored - typically the class name.
Can be null if not used.thisObjValue
- the data value.public void setName(java.lang.String thisName)
thisName
- the value object name.public java.lang.String getName()
public java.lang.String getValueType()
public void setValue(java.lang.Object thisObjValue)
thisObjValue
- the value object.public java.lang.Object getValue()
public java.lang.String toString()
toString
in class java.lang.Object
public MetricDataset toDataset() throws java.lang.Exception
MetricDataset
.java.lang.Exception
- any error.public static MetricValue toValue() throws java.lang.Exception
java.lang.Exception
- any error.public static MetricValue toValue(java.lang.Object dataPoint) throws java.lang.Exception
dataPoint
- the data point to add. This is added as is, without any type checking
or conversions, so if it is a list, maybe the MetricDataset
.toDataset
should be preferred.java.lang.Exception
- any error.public static MetricValue toValue(java.lang.String name, java.lang.String valueType, java.lang.Object dataPoint) throws java.lang.Exception
name
- a name to give the data point. This can be null, if the name is not used.valueType
- the type of the data point. This can be null, if the name is not used.dataPoint
- the data point to add. This is added as is, without any type checking
or conversions, so if it is a list, maybe the MetricDataset
.toDataset
should be preferred.java.lang.Exception
- any error.