org.terracotta.management.stats
Class ContextualStatistics

java.lang.Object
  extended by org.terracotta.management.stats.ContextualStatistics
All Implemented Interfaces:
Serializable, Iterable<Statistic<?,?>>

public final class ContextualStatistics
extends Object
implements Iterable<Statistic<?,?>>, Serializable

This class holds the Statistic list quered from a specific context

Author:
Mathieu Carbou
See Also:
Serialized Form

Constructor Summary
ContextualStatistics(String capability, Context context, Map<String,Statistic<?,?>> statistics)
           
 
Method Summary
 String getCapability()
           
 Context getContext()
           
<T extends Statistic<?,?>>
T
getStatistic(Class<T> type)
          Returns the only possible statistic for a specific type
<T extends Statistic<?,?>>
T
getStatistic(Class<T> type, String name)
          Returns the only possible statistic for a specific type and name
 Map<String,Statistic<?,?>> getStatistics()
           
<T extends Statistic<?,?>>
Map<String,T>
getStatistics(Class<T> type)
           
 boolean isEmpty()
           
 Iterator<Statistic<?,?>> iterator()
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContextualStatistics

public ContextualStatistics(String capability,
                            Context context,
                            Map<String,Statistic<?,?>> statistics)
Method Detail

getCapability

public String getCapability()

size

public int size()

isEmpty

public boolean isEmpty()

iterator

public Iterator<Statistic<?,?>> iterator()
Specified by:
iterator in interface Iterable<Statistic<?,?>>

getStatistics

public Map<String,Statistic<?,?>> getStatistics()

getStatistic

public <T extends Statistic<?,?>> T getStatistic(Class<T> type)
                                      throws NoSuchElementException
Returns the only possible statistic for a specific type

Type Parameters:
T - The Statistic type
Parameters:
type - The type of the statistic to return
Returns:
The statistic found
Throws:
NoSuchElementException - If there is 0 or more than 1 statistic for given type

getStatistic

public <T extends Statistic<?,?>> T getStatistic(Class<T> type,
                                                 String name)
                                      throws NoSuchElementException
Returns the only possible statistic for a specific type and name

Type Parameters:
T - The Statistic type
Parameters:
type - The type of the statistic to return
name - The name of the statistic to return
Returns:
The statistic found
Throws:
NoSuchElementException - If there is 0 or more than 1 statistic for given type

getStatistics

public <T extends Statistic<?,?>> Map<String,T> getStatistics(Class<T> type)

getContext

public Context getContext()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2016. All Rights Reserved.