com.vaadin.base.devserver.stats.
Class StatisticsContainer
- java.lang.Object
-
- com.vaadin.base.devserver.stats.StatisticsContainer
-
public class StatisticsContainer extends Object
Wraps a JSON data structure and provides a slightly easier API for it.
-
-
Constructor Summary
Constructors Constructor Description StatisticsContainer(com.fasterxml.jackson.databind.node.ObjectNode json)
Wraps the given json with this API.
-
Method Summary
All Methods Modifier and Type Method Description void
aggregate(String name, double newValue)
Sets the value to the given field and updates related aggregate fields.
String
getValue(String name)
Returns the given field value as a string.
double
getValueAsDouble(String name)
Returns the given field value as a double.
void
increment(String name)
Increments the value for the given field.
void
setValue(String name, long value)
Stores a long using the given field name.
void
setValue(String name, com.fasterxml.jackson.databind.JsonNode value)
Stores a JSON object using the given field name.
void
setValue(String name, String value)
Stores a string using the given field name.
-
-
-
Method Detail
-
setValue
public void setValue(String name, String value)
Stores a string using the given field name.
Parameters:
name
- name of the field to storevalue
- the value to store
-
setValue
public void setValue(String name, long value)
Stores a long using the given field name.
Parameters:
name
- name of the field to storevalue
- the value to store
-
setValue
public void setValue(String name, com.fasterxml.jackson.databind.JsonNode value)
Stores a JSON object using the given field name.
Parameters:
name
- name of the field to storevalue
- the value to store
-
increment
public void increment(String name)
Increments the value for the given field.
Parameters:
name
- the name of the field to increment
-
aggregate
public void aggregate(String name, double newValue)
Sets the value to the given field and updates related aggregate fields.
Updates the following fields:
name
The new valuename_min
The minimum valuename_max
The maximum valuename_count
Number of values collected
Parameters:
name
- Name of the field to update.newValue
- The new value to store.
-
getValue
public String getValue(String name)
Returns the given field value as a string.
Parameters:
name
- name of the field to getReturns:
the value of the field as a string
-
getValueAsDouble
public double getValueAsDouble(String name)
Returns the given field value as a double.
Parameters:
name
- name of the field to getReturns:
the value of the field as a double, 0 if missing or not a double
-
-