org.perf4j.aop
Class AbstractTimingAspect

java.lang.Object
  extended by org.perf4j.aop.AbstractTimingAspect
Direct Known Subclasses:
TimingAspect

public abstract class AbstractTimingAspect
extends java.lang.Object

This is the base class for TimingAspects. Subclasses just need to implement the log(java.lang.String, java.lang.String) method to use their logging framework of choice (e.g. log4j or java.logging) to persist the StopWatch log message.

Author:
Alex Devine

Constructor Summary
AbstractTimingAspect()
           
 
Method Summary
 java.lang.Object doPerfLogging(org.aspectj.lang.ProceedingJoinPoint pjp, Profiled profiled)
          This advice is used to add the StopWatch logging statements around method executions that have been tagged with the Profiled annotation.
protected  java.lang.String evaluateJexl(java.lang.String text, java.lang.Object[] args)
          Helper method is used to parse out {expressionLanguage} elements from the text and evaluate the strings using JEXL.
protected  java.lang.String getStopWatchMessage(org.aspectj.lang.ProceedingJoinPoint pjp, Profiled profiled)
          Helper method get the message to use for StopWatch logging.
protected  java.lang.String getStopWatchTag(org.aspectj.lang.ProceedingJoinPoint pjp, Profiled profiled)
          Helper method gets the tag to use for StopWatch logging.
protected abstract  void log(java.lang.String loggerName, java.lang.String stopWatchString)
          Subclasses must implement this method to persist the StopWatch logging message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTimingAspect

public AbstractTimingAspect()
Method Detail

doPerfLogging

public java.lang.Object doPerfLogging(org.aspectj.lang.ProceedingJoinPoint pjp,
                                      Profiled profiled)
                               throws java.lang.Throwable
This advice is used to add the StopWatch logging statements around method executions that have been tagged with the Profiled annotation.

Parameters:
pjp - The ProceedingJoinPoint encapulates the method around which this aspect advice runs.
profiled - The profiled annotation that was attached to the method.
Returns:
The return value from the method that was executed.
Throws:
java.lang.Throwable - Any exceptions thrown by the underlying method.

getStopWatchTag

protected java.lang.String getStopWatchTag(org.aspectj.lang.ProceedingJoinPoint pjp,
                                           Profiled profiled)
Helper method gets the tag to use for StopWatch logging. Performs JEXL evaluation if necessary.

Parameters:
pjp - The ProceedingJoinPoint encapulates the method around which this aspect advice runs.
profiled - The profiled annotation that was attached to the method.
Returns:
The value to use as the StopWatch tag.

getStopWatchMessage

protected java.lang.String getStopWatchMessage(org.aspectj.lang.ProceedingJoinPoint pjp,
                                               Profiled profiled)
Helper method get the message to use for StopWatch logging. Performs JEXL evaluation if necessary.

Parameters:
pjp - The ProceedingJoinPoint encapulates the method around which this aspect advice runs.
profiled - The profiled annotation that was attached to the method.
Returns:
The value to use as the StopWatch message.

evaluateJexl

protected java.lang.String evaluateJexl(java.lang.String text,
                                        java.lang.Object[] args)
Helper method is used to parse out {expressionLanguage} elements from the text and evaluate the strings using JEXL.

Parameters:
text - The text to be parsed.
args - The args that were passed to the method to be profiled.
Returns:
The evaluated string.
See Also:
Profiled.el()

log

protected abstract void log(java.lang.String loggerName,
                            java.lang.String stopWatchString)
Subclasses must implement this method to persist the StopWatch logging message.

Parameters:
loggerName - This name identifies the logger to use to persist the log message
stopWatchString - The StopWatch log to be saved.


Copyright © 2008 perf4j.org. All Rights Reserved.