org.javasimon.source
Class AbstractStopwatchSource<T>

java.lang.Object
  extended by org.javasimon.source.AbstractStopwatchSource<T>
All Implemented Interfaces:
MonitorSource<T,Stopwatch>, StopwatchSource<T>
Direct Known Subclasses:
AbstractMethodStopwatchSource

public abstract class AbstractStopwatchSource<T>
extends Object
implements StopwatchSource<T>

Base implementation for MonitorSource producings stopwatches.

Author:
gquintana

Field Summary
private  Manager manager
          Simon manager used for producing Stopwatches.
 
Constructor Summary
AbstractStopwatchSource(Manager manager)
          Constructor with Manager.
 
Method Summary
 Manager getManager()
          Returns the Manager used as a real source of monitors.
 Stopwatch getMonitor(T location)
          Provide a Stopwatch for given location.
protected abstract  String getMonitorName(T location)
          Get monitor name for the given location.
 boolean isMonitored(T location)
          Default implementation returns always true.
 Split start(T location)
          Convenient method to return split for the location or disabled split, if the location is not monitored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

private final Manager manager
Simon manager used for producing Stopwatches.

Constructor Detail

AbstractStopwatchSource

public AbstractStopwatchSource(Manager manager)
Constructor with Manager.

Parameters:
manager - Simon manager used for producing Stopwatches
Method Detail

getManager

public Manager getManager()
Description copied from interface: MonitorSource
Returns the Manager used as a real source of monitors.

Specified by:
getManager in interface MonitorSource<T,Stopwatch>
Returns:
Manager to get the monitors from

isMonitored

public boolean isMonitored(T location)
Default implementation returns always true.

Specified by:
isMonitored in interface MonitorSource<T,Stopwatch>
Parameters:
location - Location
Returns:
always true

getMonitorName

protected abstract String getMonitorName(T location)
Get monitor name for the given location.


getMonitor

public Stopwatch getMonitor(T location)
Provide a Stopwatch for given location.

Specified by:
getMonitor in interface MonitorSource<T,Stopwatch>
Parameters:
location - Location
Returns:
Stopwatch

start

public Split start(T location)
Description copied from interface: StopwatchSource
Convenient method to return split for the location or disabled split, if the location is not monitored.

Specified by:
start in interface StopwatchSource<T>
Parameters:
location - location to be monitored
Returns:
Split for the location or {Split#DISABLED} if the location is not monitored


Copyright © 2013. All Rights Reserved.