com.jcoverage.coverage
Class InstrumentClassGen

java.lang.Object
  extended bycom.jcoverage.coverage.InstrumentClassGen

class InstrumentClassGen
extends java.lang.Object

Add coverage instrumentation to an existing class. Instances of this class are normally created by @see Instrument, as part of the instrumentation process.


Field Summary
(package private)  org.apache.bcel.generic.ClassGen cg
           
(package private)  java.lang.String ignoreRegex
           
(package private) static org.apache.log4j.Logger logger
           
(package private)  java.util.Map methodConditionals
          A mapping from method name and signature to the set of conditionals for that method.
(package private)  java.util.Map methodLineNumbers
          A mapping from method name and signature to the set of line numbers for that method.
(package private)  java.util.Set methodNamesAndSignatures
          The set of method names concatenated with their signature.
(package private)  java.util.Set sourceLineNumbers
          The set of "real" source line numbers that are present in this class.
 
Constructor Summary
(package private) InstrumentClassGen(org.apache.bcel.classfile.JavaClass jc, java.lang.String ignoreRegex)
           
 
Method Summary
(package private)  void addInstrumentation()
          Add coverage instrumentation to the class.
(package private)  void addInstrumentation(org.apache.bcel.classfile.Method method)
          Add instrumentation to a method found in this class.
(package private)  void addInstrumentation(org.apache.bcel.classfile.Method[] methods)
          Add instrument to all the supplied methods.
(package private)  org.apache.bcel.generic.ClassGen getClassGen()
           
(package private)  java.util.Map getMethodConditionals()
           
(package private)  java.util.Map getMethodLineNumbers()
           
(package private)  java.util.Set getMethodNamesAndSignatures()
           
(package private)  java.util.Set getSourceLineNumbers()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static final org.apache.log4j.Logger logger

cg

final org.apache.bcel.generic.ClassGen cg

sourceLineNumbers

final java.util.Set sourceLineNumbers
The set of "real" source line numbers that are present in this class. That is, those lines of Java source code that do not represent comments, or other syntax "fluff" (e.g., "} else {"), or those lines that have been ignored because they match the ignore regex.


methodNamesAndSignatures

final java.util.Set methodNamesAndSignatures
The set of method names concatenated with their signature.


methodLineNumbers

final java.util.Map methodLineNumbers
A mapping from method name and signature to the set of line numbers for that method.


methodConditionals

final java.util.Map methodConditionals
A mapping from method name and signature to the set of conditionals for that method.

See Also:
Conditional

ignoreRegex

final java.lang.String ignoreRegex
Constructor Detail

InstrumentClassGen

InstrumentClassGen(org.apache.bcel.classfile.JavaClass jc,
                   java.lang.String ignoreRegex)
Method Detail

addInstrumentation

void addInstrumentation(org.apache.bcel.classfile.Method method)
Add instrumentation to a method found in this class.

Parameters:
method - a method present in the class

addInstrumentation

void addInstrumentation(org.apache.bcel.classfile.Method[] methods)
Add instrument to all the supplied methods.


addInstrumentation

void addInstrumentation()
Add coverage instrumentation to the class. Once instrumented, the instrumented class is tagged with a marker interface @see HasBeenInstrumented to prevent it from being instrumented again.


getClassGen

org.apache.bcel.generic.ClassGen getClassGen()

getSourceLineNumbers

java.util.Set getSourceLineNumbers()
Returns:
the set of source line numbers for this class

getMethodLineNumbers

java.util.Map getMethodLineNumbers()
Returns:
a mapping from method name and signature to the set of line numbers for that method.

getMethodConditionals

java.util.Map getMethodConditionals()
Returns:
a mapping from method name and signature to the set of conditionals for that method.
See Also:
Conditional

getMethodNamesAndSignatures

java.util.Set getMethodNamesAndSignatures()
Returns:
the set of method names and signatures that can be found in this class.