org.multiverse.instrumentation
Class StandardInstrumentor

java.lang.Object
  extended by org.multiverse.instrumentation.StandardInstrumentor
All Implemented Interfaces:
Instrumentor

public class StandardInstrumentor
extends java.lang.Object
implements Instrumentor

Author:
Peter Veentjer

Constructor Summary
StandardInstrumentor(java.lang.String compilerName, java.lang.String compilerVersion, java.lang.String stmName)
           
 
Method Summary
protected  void add(InstrumentationPhase phase)
           
 void exclude(java.lang.String pattern)
           
 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 pattern)
          Add a pattern that is included.
 Clazz process(Clazz originalClazz)
          Processes a clazz.
 java.lang.String removeTrailingAndPrecedingSemicolons(java.lang.String s)
           
 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 log)
          Sets the InstrumenterLogger this Instrumentor uses to execute log statements on.
 void setOptimize(boolean optimize)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardInstrumentor

public StandardInstrumentor(java.lang.String compilerName,
                            java.lang.String compilerVersion,
                            java.lang.String stmName)
Method Detail

add

protected final void add(InstrumentationPhase phase)

getName

public java.lang.String getName()
Description copied from interface: Instrumentor
Returns the name of this Instrumentor. Needed for identification and logging purpuses.

Specified by:
getName in interface Instrumentor
Returns:
the name of this Instrumentor.
See Also:
Instrumentor.getVersion()

getVersion

public java.lang.String getVersion()
Description copied from interface: Instrumentor
Returns the version of this Instrumentor. Needed for identification and logging purposes.

Specified by:
getVersion in interface Instrumentor
Returns:
the version of this Instrumentor.
See Also:
Instrumentor.getName()

getStmName

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

Specified by:
getStmName in interface Instrumentor
Returns:
the name of the Stm

getExcluded

public java.lang.String getExcluded()
Description copied from interface: Instrumentor
Returns a string containing all

Specified by:
getExcluded in interface Instrumentor
Returns:

getIncluded

public java.lang.String getIncluded()
Specified by:
getIncluded in interface Instrumentor

exclude

public void exclude(java.lang.String pattern)
Specified by:
exclude in interface Instrumentor

removeTrailingAndPrecedingSemicolons

public java.lang.String removeTrailingAndPrecedingSemicolons(java.lang.String s)

include

public void include(java.lang.String pattern)
Description copied from interface: Instrumentor
Add a pattern that is included. Default everything is included, unless it is explicitly excluded. The pattern is just the

Specified by:
include in interface Instrumentor

setLog

public void setLog(InstrumenterLogger log)
Description copied from interface: Instrumentor
Sets the InstrumenterLogger this Instrumentor uses to execute log statements on.

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

Specified by:
setLog in interface Instrumentor

setDumpBytecode

public void setDumpBytecode(boolean dumpBytecode)
Description copied from interface: Instrumentor
If the bytecode generated by this Instrumentor should be dumped for debugging purposes.

Specified by:
setDumpBytecode in interface Instrumentor
Parameters:
dumpBytecode - true if bytecode should be dumpted.
See Also:
Instrumentor.setDumpDirectory(java.io.File)

setDumpDirectory

public void setDumpDirectory(java.io.File dumpDirectory)
Description copied from interface: Instrumentor
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.

Specified by:
setDumpDirectory in interface Instrumentor
Parameters:
dumpDirectory - the directory to write the dumped classfiles to.

getDumpDirectory

public java.io.File getDumpDirectory()
Specified by:
getDumpDirectory in interface Instrumentor

setFiler

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

Specified by:
setFiler in interface Instrumentor
Parameters:
filer - the filer this Instrumentor is going to use.

setOptimize

public void setOptimize(boolean optimize)
Specified by:
setOptimize in interface Instrumentor

process

public Clazz process(Clazz originalClazz)
Description copied from interface: Instrumentor
Processes a clazz. If nothing needs to be processed, the provided clazz can be returned. The return value should never be null.

Specified by:
process in interface Instrumentor
Parameters:
originalClazz - the Clazz to transform.
Returns:
the transformed clazz. If extra classes need to be generated, they are created using the Filer.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008-2010 Multiverse. All Rights Reserved.