public final class AgentOptions extends Object
key1=value1,key2=value2,key3=value3
Modifier and Type | Class and Description |
---|---|
static class |
AgentOptions.OutputMode
Possible values for
OUTPUT . |
Modifier and Type | Field and Description |
---|---|
static String |
ADDRESS
The IP address or DNS name the tcpserver binds to or the tcpclient
connects to.
|
static String |
APPEND
Specifies whether execution data should be appended to the output file.
|
static String |
CLASSDUMPDIR
Specifies where the agent dumps all class files it encounters.
|
static String |
DEFAULT_ADDRESS
Default value for the "address" agent option.
|
static String |
DEFAULT_DESTFILE
Default value for the "destfile" agent option.
|
static int |
DEFAULT_PORT
Default value for the "port" agent option.
|
static String |
DESTFILE
Specifies the output file for execution data.
|
static String |
DUMPONEXIT
Specifies whether the agent will automatically dump coverage data on VM
exit.
|
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 |
INCLBOOTSTRAPCLASSES
Specifies whether also classes from the bootstrap classloader should be
instrumented.
|
static String |
INCLNOLOCATIONCLASSES
Specifies whether also classes without a source location should be
instrumented.
|
static String |
INCLUDES
Wildcard expression for class names that should be included for code
coverage.
|
static String |
JMX
Specifies whether the agent should expose functionality via JMX under the
name "org.jacoco:type=Runtime".
|
static String |
OUTPUT
Specifies the output mode.
|
static String |
PORT
The port the tcpserver binds to or the tcpclient connects to.
|
static String |
SESSIONID
Specifies a session identifier that is written with the execution data.
|
Constructor and Description |
---|
AgentOptions()
New instance with all values set to default.
|
AgentOptions(Properties properties)
New instance read from the given
Properties object. |
AgentOptions(String optionstr)
New instance parsed from the given option string.
|
Modifier and Type | Method and Description |
---|---|
String |
getAddress()
Gets the hostname or IP address to listen to when output is
tcpserver or connect to when output is
tcpclient |
boolean |
getAppend()
Returns whether the output should be appended to an existing file.
|
String |
getClassDumpDir()
Returns the location of the directory where class files should be dumped
to.
|
String |
getDestfile()
Returns the output file location.
|
boolean |
getDumpOnExit()
Returns whether coverage data should be dumped on exit.
|
String |
getExclClassloader()
Returns the wildcard expression for excluded class loaders.
|
String |
getExcludes()
Returns the wildcard expression for classes to exclude.
|
boolean |
getInclBootstrapClasses()
Returns whether classes from the bootstrap classloader should be
instrumented.
|
boolean |
getInclNoLocationClasses()
Returns whether classes without source location should be instrumented.
|
String |
getIncludes()
Returns the wildcard expression for classes to include.
|
boolean |
getJmx()
Returns whether the agent exposes functionality via JMX.
|
AgentOptions.OutputMode |
getOutput()
Returns the output mode
|
int |
getPort()
Returns the port on which to listen to when the output is
tcpserver or the port to connect to when output is
tcpclient . |
String |
getQuotedVMArgument(File agentJarFile)
Generate required quoted JVM argument based on current configuration and
supplied agent jar location.
|
String |
getSessionId()
Returns the session identifier.
|
String |
getVMArgument(File agentJarFile)
Generate required JVM argument based on current configuration and
supplied agent jar location.
|
String |
prependVMArguments(String arguments,
File agentJarFile)
Generate required quotes JVM argument based on current configuration and
prepends it to the given argument command line.
|
void |
setAddress(String address)
Sets the hostname or IP address to listen to when output is
tcpserver or connect to when output is
tcpclient |
void |
setAppend(boolean append)
Sets whether the output should be appended to an existing file.
|
void |
setClassDumpDir(String location)
Sets the directory where class files should be dumped to.
|
void |
setDestfile(String destfile)
Sets the output file location.
|
void |
setDumpOnExit(boolean dumpOnExit)
Sets whether coverage data should be dumped on exit.
|
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 |
setInclBootstrapClasses(boolean include)
Sets whether classes from the bootstrap classloader should be
instrumented.
|
void |
setInclNoLocationClasses(boolean include)
Sets whether classes without source location should be instrumented.
|
void |
setIncludes(String includes)
Sets the wildcard expression for classes to include.
|
void |
setJmx(boolean jmx)
Sets whether the agent should expose functionality via JMX.
|
void |
setOutput(AgentOptions.OutputMode output)
Sets the output mode
|
void |
setOutput(String output)
Sets the output mode
|
void |
setPort(int port)
Sets the port on which to listen to when output is
tcpserver
or the port to connect to when output is tcpclient |
void |
setSessionId(String id)
Sets the session identifier.
|
String |
toString()
Creates a string representation that can be passed to the agent via the
command line.
|
public static final String DESTFILE
jacoco.exec
in the working directory.public static final String DEFAULT_DESTFILE
public static final String APPEND
true
.public static final String INCLUDES
*
(all classes included).WildcardMatcher
,
Constant Field Valuespublic static final String EXCLUDES
WildcardMatcher
,
Constant Field Valuespublic static final String EXCLCLASSLOADER
sun.reflect.DelegatingClassLoader
.WildcardMatcher
,
Constant Field Valuespublic static final String INCLBOOTSTRAPCLASSES
false
.public static final String INCLNOLOCATIONCLASSES
false
.public static final String SESSIONID
public static final String DUMPONEXIT
true
.public static final String OUTPUT
AgentOptions.OutputMode.file
.public static final String ADDRESS
DEFAULT_ADDRESS
.public static final String DEFAULT_ADDRESS
public static final String PORT
DEFAULT_PORT
.public static final int DEFAULT_PORT
public static final String CLASSDUMPDIR
null
(no dumps).public static final String JMX
false
.public AgentOptions()
public AgentOptions(String optionstr)
optionstr
- string to parse or null
public AgentOptions(Properties properties)
Properties
object.properties
- Properties
object to read configuration options frompublic String getDestfile()
public void setDestfile(String destfile)
destfile
- output file locationpublic boolean getAppend()
true
, when the output should be appendedpublic void setAppend(boolean append)
append
- true
, when the output should be appendedpublic String getIncludes()
WildcardMatcher
public void setIncludes(String includes)
includes
- wildcard expression for classes to includeWildcardMatcher
public String getExcludes()
WildcardMatcher
public void setExcludes(String excludes)
excludes
- wildcard expression for classes to excludeWildcardMatcher
public String getExclClassloader()
WildcardMatcher
public void setExclClassloader(String expression)
expression
- expression for excluded class loadersWildcardMatcher
public boolean getInclBootstrapClasses()
true
if classes from the bootstrap classloader
should be instrumentedpublic void setInclBootstrapClasses(boolean include)
include
- true
if bootstrap classes should be instrumentedpublic boolean getInclNoLocationClasses()
true
if classes without source location should be
instrumentedpublic void setInclNoLocationClasses(boolean include)
include
- true
if classes without source location should be
instrumentedpublic String getSessionId()
public void setSessionId(String id)
id
- session identifierpublic boolean getDumpOnExit()
true
if coverage data will be written on VM exitpublic void setDumpOnExit(boolean dumpOnExit)
dumpOnExit
- true
if coverage data should be written on VM
exitpublic int getPort()
tcpserver
or the port to connect to when output is
tcpclient
.public void setPort(int port)
tcpserver
or the port to connect to when output is tcpclient
port
- port to listen on or connect topublic String getAddress()
tcpserver
or connect to when output is
tcpclient
public void setAddress(String address)
tcpserver
or connect to when output is
tcpclient
address
- Hostname or IP addresspublic AgentOptions.OutputMode getOutput()
public void setOutput(String output)
output
- Output modepublic void setOutput(AgentOptions.OutputMode output)
output
- Output modepublic String getClassDumpDir()
null
(no dumps)public void setClassDumpDir(String location)
location
- dump location or null
(no dumps)public boolean getJmx()
true
, when JMX is enabledpublic void setJmx(boolean jmx)
jmx
- true
if JMX should be enabledpublic String getVMArgument(File agentJarFile)
agentJarFile
- location of the JaCoCo Agent Jarpublic String getQuotedVMArgument(File agentJarFile)
agentJarFile
- location of the JaCoCo Agent Jarpublic String prependVMArguments(String arguments, File agentJarFile)
arguments
- existing command line arguments or null
agentJarFile
- location of the JaCoCo Agent JarCopyright © 2016. All rights reserved.