org.jacoco.core.runtime
Class AgentOptions

java.lang.Object
  extended by org.jacoco.core.runtime.AgentOptions

public class AgentOptions
extends Object

Utility to create and parse options for the runtime agent. Options are represented as a string in the following format:

   key1=value1,key2=value2,key3=value3
 

Version:
$Revision: $
Author:
Marc R. Hoffmann

Field Summary
static String APPEND
          Specifies whether execution data should be appended to the output file.
static String DESTFILE
          Specifies the output file for execution data.
static String EXCLCLASSLOADER
          Wildcard expression for class loaders names for classes that should be excluded from code coverage.
static String EXCLUDES
          Wildcard expression for class names that should be excluded from code coverage.
static String INCLUDES
          Wildcard expression for class names that should be included for code coverage.
 
Constructor Summary
AgentOptions()
          New instance with all values set to default.
AgentOptions(String optionstr)
          New instance parsed from the given option string.
 
Method Summary
 boolean getAppend()
          Returns whether the output should be appended to an existing file.
 String getDestfile()
          Returns the output file location.
 String getExclClassloader()
          Returns the wildcard expression for excluded class loaders.
 String getExcludes()
          Returns the wildcard expression for classes to exclude.
 String getIncludes()
          Returns the wildcard expression for classes to include.
 String getVMArgument(File agentJarFile)
          Generate required JVM argument string based on current configuration and supplied agent jar location
 void setAppend(boolean append)
          Sets whether the output should be appended to an existing file.
 void setDestfile(String destfile)
          Sets the output file location.
 void setExclClassloader(String expression)
          Sets the wildcard expression for excluded class loaders.
 void setExcludes(String excludes)
          Sets the wildcard expression for classes to exclude.
 void setIncludes(String includes)
          Sets the wildcard expression for classes to include.
 String toString()
          Creates a string representation that can be passed to the agent via the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DESTFILE

public static final String DESTFILE
Specifies the output file for execution data. Default is jacoco.exec in the working directory.

See Also:
Constant Field Values

APPEND

public static final String APPEND
Specifies whether execution data should be appended to the output file. Default is true.

See Also:
Constant Field Values

INCLUDES

public static final String INCLUDES
Wildcard expression for class names that should be included for code coverage. Default is * (all classes included).

See Also:
WildcardMatcher, Constant Field Values

EXCLUDES

public static final String EXCLUDES
Wildcard expression for class names that should be excluded from code coverage. Default is the empty string (no exclusions).

See Also:
WildcardMatcher, Constant Field Values

EXCLCLASSLOADER

public static final String EXCLCLASSLOADER
Wildcard expression for class loaders names for classes that should be excluded from code coverage. This means all classes loaded by a class loader which full qualified name matches this expression will be ignored for code coverage regardless of all other filtering settings. Default is sun.reflect.DelegatingClassLoader.

See Also:
WildcardMatcher, Constant Field Values
Constructor Detail

AgentOptions

public AgentOptions()
New instance with all values set to default.


AgentOptions

public AgentOptions(String optionstr)
New instance parsed from the given option string.

Parameters:
optionstr - string to parse or null
Method Detail

getDestfile

public String getDestfile()
Returns the output file location.

Returns:
output file location

setDestfile

public void setDestfile(String destfile)
Sets the output file location.

Parameters:
destfile - output file location

getAppend

public boolean getAppend()
Returns whether the output should be appended to an existing file.

Returns:
true, when the output should be appended

setAppend

public void setAppend(boolean append)
Sets whether the output should be appended to an existing file.

Parameters:
append - true, when the output should be appended

getIncludes

public String getIncludes()
Returns the wildcard expression for classes to include.

Returns:
wildcard expression for classes to include
See Also:
WildcardMatcher

setIncludes

public void setIncludes(String includes)
Sets the wildcard expression for classes to include.

Parameters:
includes - wildcard expression for classes to include
See Also:
WildcardMatcher

getExcludes

public String getExcludes()
Returns the wildcard expression for classes to exclude.

Returns:
wildcard expression for classes to exclude
See Also:
WildcardMatcher

setExcludes

public void setExcludes(String excludes)
Sets the wildcard expression for classes to exclude.

Parameters:
excludes - wildcard expression for classes to exclude
See Also:
WildcardMatcher

getExclClassloader

public String getExclClassloader()
Returns the wildcard expression for excluded class loaders.

Returns:
expression for excluded class loaders
See Also:
WildcardMatcher

setExclClassloader

public void setExclClassloader(String expression)
Sets the wildcard expression for excluded class loaders.

Parameters:
expression - expression for excluded class loaders
See Also:
WildcardMatcher

getVMArgument

public String getVMArgument(File agentJarFile)
Generate required JVM argument string based on current configuration and supplied agent jar location

Parameters:
agentJarFile - location of the JaCoCo Agent Jar
Returns:
Argument to pass to create new VM with coverage enabled

toString

public String toString()
Creates a string representation that can be passed to the agent via the command line. Might be the empty string, if no options are set.

Overrides:
toString in class Object