|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkorat.instrumentation.AbstractInstrumenter
abstract class AbstractInstrumenter
Base instrumenter class.
Implements getByteCode(String)
method (from
IInstrumenter
interface) using template method design
pattern. Subclasses should only override instrument(CtClass)
method which does the instrumentation in the terms of the javassist, i.e.
instruments given javassist CtClass
object.
FieldInstrumenter
,
ArrayFieldInstrumenter
,
SpecialConstructorInstrumenter
Field Summary | |
---|---|
protected ClassPool |
cp
|
Constructor Summary | |
---|---|
protected |
AbstractInstrumenter()
|
Method Summary | |
---|---|
byte[] |
getBytecode(String className)
Gets instrumented bytecode (to be given to the class loader, for example). |
protected abstract void |
instrument(CtClass clz)
|
protected boolean |
shouldProcessField(CtField f)
Helper: returns if the given field should be processed i.e. instrumented. |
protected boolean |
shouldProcessMethod(CtMethod m)
Helper: generally, abstract and native methods should not be processed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ClassPool cp
Constructor Detail |
---|
protected AbstractInstrumenter()
Method Detail |
---|
public byte[] getBytecode(String className) throws ClassNotFoundException
IInstrumenter
getBytecode
in interface IInstrumenter
className
- full class name
ClassNotFoundException
- if class with the className
name is not foundIInstrumenter.getBytecode(java.lang.String)
protected abstract void instrument(CtClass clz) throws CannotCompileException, NotFoundException, IOException
CannotCompileException
NotFoundException
IOException
protected boolean shouldProcessField(CtField f)
FilterManager
instance should be consulted about user configured excluded-from-instrumentation
packages. Subclasses may override this method if different policy is needed.
f
- - field to instrument or not
protected boolean shouldProcessMethod(CtMethod m)
m
- - method to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |