org.multiverse.instrumentation
Interface Instrumentor

All Known Implementing Classes:
StandardInstrumentor

public interface Instrumentor

The Instrumentor is responsible transforming a Clazz.

The same Instrumentor can be used for compiletime instrumentation and loadtime instrumentation, so no worries about that anymore.

Author:
Peter Veentjer

Method Summary
 void exclude(java.lang.String ignored)
           
 java.io.File getDumpDirectory()
           
 java.lang.String getExcluded()
          Returns a string containing all
 java.lang.String getIncluded()
           
 java.lang.String getName()
          Returns the name of this Instrumentor.
 java.lang.String getStmName()
          Returns the name of the Stm this Instrumentor is going to do the instrumentation for.
 java.lang.String getVersion()
          Returns the version of this Instrumentor.
 void include(java.lang.String included)
          Add a pattern that is included.
 Clazz process(Clazz originalClazz)
          Processes a clazz.
 void setDumpBytecode(boolean dumpBytecode)
          If the bytecode generated by this Instrumentor should be dumped for debugging purposes.
 void setDumpDirectory(java.io.File dumpDirectory)
          Sets the location of this Instrumentor.
 void setFiler(Filer filer)
          Sets the Filer for this Instrumentor.
 void setLog(InstrumenterLogger logger)
          Sets the InstrumenterLogger this Instrumentor uses to execute log statements on.
 void setOptimize(boolean optimize)
           
 

Method Detail

getName

java.lang.String getName()
Returns the name of this Instrumentor. Needed for identification and logging purpuses.

Returns:
the name of this Instrumentor.
See Also:
getVersion()

getVersion

java.lang.String getVersion()
Returns the version of this Instrumentor. Needed for identification and logging purposes.

Returns:
the version of this Instrumentor.
See Also:
getName()

getStmName

java.lang.String getStmName()
Returns the name of the Stm this Instrumentor is going to do the instrumentation for. It is purely used for debugging/logging purposes.

Returns:
the name of the Stm

setFiler

void setFiler(Filer filer)
Sets the Filer for this Instrumentor. The Filer can be used to do callbacks for creating additional resources like classes.

Parameters:
filer - the filer this Instrumentor is going to use.

setDumpBytecode

void setDumpBytecode(boolean dumpBytecode)
If the bytecode generated by this Instrumentor should be dumped for debugging purposes.

Parameters:
dumpBytecode - true if bytecode should be dumpted.
See Also:
setDumpDirectory(java.io.File)

setDumpDirectory

void setDumpDirectory(java.io.File dumpDirectory)
Sets the location of this Instrumentor. The default is the tmp directory so in most cases you don't need to worry about this property.

Parameters:
dumpDirectory - the directory to write the dumped classfiles to.

getDumpDirectory

java.io.File getDumpDirectory()

setLog

void setLog(InstrumenterLogger logger)
Sets the InstrumenterLogger this Instrumentor uses to execute log statements on.

So if you want to have verbose output, just plug in some logger.

Parameters:
logger -

include

void include(java.lang.String included)
Add a pattern that is included. Default everything is included, unless it is explicitly excluded. The pattern is just the

Parameters:
included -

exclude

void exclude(java.lang.String ignored)

getExcluded

java.lang.String getExcluded()
Returns a string containing all

Returns:

getIncluded

java.lang.String getIncluded()

process

Clazz process(Clazz originalClazz)
Processes a clazz. If nothing needs to be processed, the provided clazz can be returned. The return value should never be null.

Parameters:
originalClazz - the Clazz to transform.
Returns:
the transformed clazz. If extra classes need to be generated, they are created using the Filer.
Throws:
CompileException - if something goes wrong while compile clazz.

setOptimize

void setOptimize(boolean optimize)


Copyright © 2008-2010 Multiverse. All Rights Reserved.