Package 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 Instance Methods Concrete Methods Modifier and Type Method Description voidaggregate(String name, double newValue)Sets the value to the given field and updates related aggregate fields.StringgetValue(String name)Returns the given field value as a string.doublegetValueAsDouble(String name)Returns the given field value as a double.voidincrement(String name)Increments the value for the given field.voidsetValue(String name, long value)Stores a long using the given field name.voidsetValue(String name, com.fasterxml.jackson.databind.JsonNode value)Stores a JSON object using the given field name.voidsetValue(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:
nameThe new valuename_minThe minimum valuename_maxThe maximum valuename_countNumber 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 get- Returns:
- 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 get- Returns:
- the value of the field as a double, 0 if missing or not a double
-
-