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 Details

    • StatisticsContainer

      public StatisticsContainer(com.fasterxml.jackson.databind.node.ObjectNode json)

      Wraps the given json with this API.

      Parameters:

      json - the json to wrap

  • Method Details

    • setValue

      public void setValue(String name, String value)

      Stores a string using the given field name.

      Parameters:

      name - name of the field to store

      value - 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 store

      value - 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 store

      value - 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 value
      • name_min The minimum value
      • name_max The maximum value
      • name_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 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