net.grinder.scriptengine
Class AbstractDCRInstrumenter

java.lang.Object
  extended by net.grinder.scriptengine.AbstractDCRInstrumenter
All Implemented Interfaces:
Instrumenter
Direct Known Subclasses:
Jython22Instrumenter, Jython25Instrumenter

public abstract class AbstractDCRInstrumenter
extends Object
implements Instrumenter

Convenient base class for DCR instrumenters.

Author:
Philip Aston

Field Summary
 
Fields inherited from interface net.grinder.scriptengine.Instrumenter
ALL_INSTRUMENTATION
 
Constructor Summary
protected AbstractDCRInstrumenter(DCRContext context)
          Constructor for AbstractDCRInstrumenter.
 
Method Summary
 Object createInstrumentedProxy(Test test, Recorder recorder, Object target)
          Create a proxy object that wraps an target object for a test.
protected  DCRContext getContext()
          Provide subclasses convenient access to the DCR context.
protected abstract  boolean instrument(Object target, Recorder recorder, Test.InstrumentationFilter filter)
          Hook for sub-class to implement instrumentation.
 boolean instrument(Test test, Recorder recorder, Object target)
          Instrument a target object with a test.
 boolean instrument(Test test, Recorder recorder, Object target, Test.InstrumentationFilter filter)
          Selectively instrument a target object with a test.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.grinder.scriptengine.Instrumenter
getDescription
 

Constructor Detail

AbstractDCRInstrumenter

protected AbstractDCRInstrumenter(DCRContext context)
Constructor for AbstractDCRInstrumenter.

Parameters:
context - The DCR context.
Method Detail

getContext

protected final DCRContext getContext()
Provide subclasses convenient access to the DCR context.

Returns:
The DCR context.

createInstrumentedProxy

public final Object createInstrumentedProxy(Test test,
                                            Recorder recorder,
                                            Object target)
                                     throws NotWrappableTypeException
Create a proxy object that wraps an target object for a test.

Specified by:
createInstrumentedProxy in interface Instrumenter
Parameters:
test - The test.
recorder - The proxy should use this to instrument the work.
target - Object to wrap.
Returns:
The instrumented proxy.
Throws:
NotWrappableTypeException - If the target object cannot be wrapped.

instrument

public boolean instrument(Test test,
                          Recorder recorder,
                          Object target)
                   throws NonInstrumentableTypeException
Instrument a target object with a test.

Specified by:
instrument in interface Instrumenter
Parameters:
test - The test.
recorder - Wire the instrumentation to this Recorder.
target - The object to instrument.
Returns:
true if instrumentation was added.
Throws:
NonInstrumentableTypeException - If the target object cannot be instrumented.

instrument

public final boolean instrument(Test test,
                                Recorder recorder,
                                Object target,
                                Test.InstrumentationFilter filter)
                         throws NonInstrumentableTypeException
Selectively instrument a target object with a test.

Specified by:
instrument in interface Instrumenter
Parameters:
test - The test.
recorder - Wire the instrumentation to this Recorder.
target - The object to instrument.
filter - Selects the parts of target to instrument.
Returns:
true if instrumentation was added.
Throws:
NonInstrumentableTypeException - If the target object cannot be instrumented.

instrument

protected abstract boolean instrument(Object target,
                                      Recorder recorder,
                                      Test.InstrumentationFilter filter)
                               throws NonInstrumentableTypeException
Hook for sub-class to implement instrumentation.

Parameters:
target - Target object.
recorder - Recorder.
filter - Selects the parts of target to instrument.
Returns:
true If this instrumenter successfully processed target, otherwise false.
Throws:
NonInstrumentableTypeException - If the target object is not of an instrumentable type.


Copyright © 2000-2013. All Rights Reserved.