public final class StatisticsMap extends Object implements Serializable
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.Constructor and Description |
---|
StatisticsMap()
Create an empty map.
|
StatisticsMap(List<RuntimeStatistic<?>> entries)
Creates a map consisting of the specified entries
|
Modifier and Type | Method and Description |
---|---|
List<RuntimeStatistic<?>> |
entries()
Returns the list of statistic pairs
|
StatisticsMap |
finalSnapshot()
Returns a map of all the statistics in this map, converting to final snapshots.
|
<T extends StatisticSupplier> |
get(StatisticDefinition<T> definition)
Returns the value corresponding to the given definition
|
Set<StatisticDefinition<?>> |
keys()
Returns the set of keys.
|
<T extends StatisticSupplier> |
put(RuntimeStatistic<T> statistic)
Type-safe put that adds a pair of statistic and definition
|
void |
put(StatisticDefinition<?> definition,
StatisticSupplier supplier)
Adds a value to the map.
|
int |
size()
Returns the number of entries in the map
|
public StatisticsMap()
public StatisticsMap(List<RuntimeStatistic<?>> entries)
entries
- the list of entriespublic <T extends StatisticSupplier> void put(RuntimeStatistic<T> statistic)
T
- the type of supplierstatistic
- the statistic to addpublic void put(StatisticDefinition<?> definition, StatisticSupplier supplier)
definition
- the definition.supplier
- the supplierClassCastException
- If the supplier is not of a type appropriate
for the definition.public <T extends StatisticSupplier> T get(StatisticDefinition<T> definition)
T
- the type of supplier that corresponds to the definition.definition
- the definitionpublic Set<StatisticDefinition<?>> keys()
public List<RuntimeStatistic<?>> entries()
public int size()
public StatisticsMap finalSnapshot()
Copyright © 2020 Actian Corporation. All rights reserved.