java.lang.Object
com.pervasive.datarush.monitoring.StatisticsMap
- All Implemented Interfaces:
Serializable
Utility that provides a mapping from
StatisticDefinition to
StatisticSupplier. This map is backed by a LinkedHashMap so
that insertion order is preserved. As values are added to the map, we check
that the supplier is of an appropriate type so that on read we then get a
type-safe lookup.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty map.StatisticsMap(List<RuntimeStatistic<?>> entries) Creates a map consisting of the specified entries -
Method Summary
Modifier and TypeMethodDescriptionList<RuntimeStatistic<?>>entries()Returns the list of statistic pairsReturns a map of all the statistics in this map, converting to final snapshots.<T extends StatisticSupplier>
Tget(StatisticDefinition<T> definition) Returns the value corresponding to the given definitionkeys()Returns the set of keys.<T extends StatisticSupplier>
voidput(RuntimeStatistic<T> statistic) Type-safe put that adds a pair of statistic and definitionvoidput(StatisticDefinition<?> definition, StatisticSupplier supplier) Adds a value to the map.intsize()Returns the number of entries in the map
-
Constructor Details
-
StatisticsMap
public StatisticsMap()Create an empty map. -
StatisticsMap
Creates a map consisting of the specified entries- Parameters:
entries- the list of entries
-
-
Method Details
-
put
Type-safe put that adds a pair of statistic and definition- Type Parameters:
T- the type of supplier- Parameters:
statistic- the statistic to add
-
put
Adds a value to the map.- Parameters:
definition- the definition.supplier- the supplier- Throws:
ClassCastException- If the supplier is not of a type appropriate for the definition.
-
get
Returns the value corresponding to the given definition- Type Parameters:
T- the type of supplier that corresponds to the definition.- Parameters:
definition- the definition- Returns:
- the value. will never be null but may be "unavailable"
-
keys
Returns the set of keys. This will be returned in the order in which the values were added to the map.- Returns:
- the set of keys
-
entries
Returns the list of statistic pairs- Returns:
- the entries in the map
-
size
public int size()Returns the number of entries in the map- Returns:
- the number of entries in the map
-
finalSnapshot
Returns a map of all the statistics in this map, converting to final snapshots.- Returns:
- a final snapshot of this map
-