public final class OptionsAndArgs extends Object
Constructor and Description |
---|
OptionsAndArgs(Set<String> pCommands,
String... pArgs)
Parse a list of arguments.
|
Modifier and Type | Method and Description |
---|---|
String |
getCommand()
The command given as argument
|
List<String> |
getExtraArgs()
Get extra arguments in addition to the command, or an empty list
|
String |
getJarFileName()
Name of the agents jar file
|
String |
getJarFilePath()
Path to this agents jar file
|
String |
getPid()
Process id as given as argument (if any).
|
String |
getPort()
Get the configured port
|
Pattern |
getProcessPattern()
A pattern used for matching a process name.
|
boolean |
isQuiet()
Whether the program should be silent
|
boolean |
isVerbose()
Verbose output if this is true
|
static File |
lookupJarFile()
Lookup the JAR File from where this class is loaded
|
boolean |
needsVm()
Return
true if this command required a attached VM or false otherwise |
String |
toAgentArg()
Convert options to agent readable options (i.e.
|
public OptionsAndArgs(Set<String> pCommands, String... pArgs)
OPTIONS
and SHORT_OPTS
. For options with arguments, the argument can
bei either provided in the form '--option=value' or '--option value'. Everything which is
not an option is considered to be an argument. Two arguments are allowed: The command
(first) and the PID (second). Any non numeric PID is considered to be a pattern. Either getPid()
or
getProcessPattern()
is set.
If no PID/pattern and no command is given the "list" command is implied. If as first argument a pure numeric value
or a pattern (which must not be equal to a valid command) is given, then "toggle" is infered with the given
PID/pattern.pCommands
- set of commands which are knownpArgs
- arguments as given on the command lineIllegalArgumentException
- if parsing failspublic String toAgentArg()
public String getPid()
public Pattern getProcessPattern()
getPid()
return a non-null value,
this method returns always nullpublic String getCommand()
public List<String> getExtraArgs()
public boolean isQuiet()
public String getPort()
public boolean isVerbose()
public boolean needsVm()
true
if this command required a attached VM or false
otherwisepublic String getJarFilePath()
public String getJarFileName()
public static File lookupJarFile()
Copyright © 2018. All rights reserved.