Package com.facilita.fc.runtime
Class Metric
- java.lang.Object
-
- com.facilita.fc.runtime.Metric
-
public class Metric extends java.lang.ObjectRepresents a user-defined metric that can be recorded by eggPlant Performance.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MetricfromString(java.lang.String text)Initializes an instance of the Metric class, from the passed String value.java.lang.Stringname()Gets the name of the metric.booleanpass()Returnstrueif the metric passed.java.lang.StringtoString()Returns aStringthat represents the currentMetric.intvalue()Gets the value of the metric.
-
-
-
Constructor Detail
-
Metric
public Metric(java.lang.String name, int value, boolean pass) throws BadValueExceptionCreates aMetricobject, specifying whether the metric passed or failed.- Parameters:
name- the name of the metricvalue- the value associated with the metricpass- whether the metric passed or failed- Throws:
BadValueException- the name of the metric is not valid
-
Metric
public Metric(java.lang.String name, int value) throws BadValueExceptionCreates aMetricobject.- Parameters:
name- the name of the metricvalue- the value associated with the metric- Throws:
BadValueException- the name of the metric is not valid
-
-
Method Detail
-
name
public java.lang.String name()
Gets the name of the metric.- Returns:
- the name of the metric
-
value
public int value()
Gets the value of the metric.- Returns:
- the value of the metric
-
pass
public boolean pass()
Returnstrueif the metric passed.- Returns:
trueif the metric passed
-
toString
public java.lang.String toString()
Returns aStringthat represents the currentMetric.The metric is represented as a
name=valuepair. For failed metrics,",F"is appended.e.g.
"myMetric=12,F"- Overrides:
toStringin classjava.lang.Object- Returns:
- a
Stringrepresentation of the curentMetric
-
fromString
public static Metric fromString(java.lang.String text) throws BadValueException
Initializes an instance of the Metric class, from the passed String value.
Takes a string in the following format and constructs a Metric instance:
"myMetric01=12,F"
For pass values of true omit the",F"from the string.
"myMetric02=34"The following example demonstrates constructing a Metric object from a string:
string metricText = "myMetric01=12,F";
Metric myMetric = Metric.FromString(metricText);- Parameters:
text- - String- Returns:
- Metric
- Throws:
BadValueException- Thetextwas invalid
-
-