public class SimpleOptionMap extends Object
Map(
"-AprintAllQualifiers" => null
"-classpath" => "myDir1:myDir2"
)
This class is mainly used by TestConfigurationBuilder to make working with existing options
simpler and less error prone. It is not intended for a general Option container because users
creating tests via source code can more easily manipulate the map whereas a lot of sugar would be
needed to make this class usable from the command line.Constructor and Description |
---|
SimpleOptionMap() |
Modifier and Type | Method and Description |
---|---|
void |
addOption(String option)
Adds an option that takes no argument.
|
void |
addOption(String option,
String value)
Adds an option that takes an argument.
|
void |
addOptionIfValueNonEmpty(String option,
String value)
Adds the option only if value is a non-null, non-empty String.
|
void |
addOptions(Iterable<String> newOptions) |
void |
addOptions(Map<String,String> options)
Adds all of the options in the given map to this one.
|
void |
addToPathOption(String key,
String toAppend)
A method to easily add Strings to an option that takes a filepath as an argument.
|
Map<String,String> |
getOptions()
Returns the map that backs this SimpleOptionMap.
|
List<String> |
getOptionsAsList()
Creates a "flat" list representation of these options.
|
void |
setOptions(Map<String,String> options)
Clears the current set of options and copies the input options to this map.
|
public void setOptions(Map<String,String> options)
options
- the new options to use for this objectpublic void addToPathOption(String key, String toAppend)
key
- an option with an argument of the form "arg1[path-separator]arg2..." e.g., "-cp
myDir:myDir2:myDir3"toAppend
- a string to append onto the path or, if the path is null/empty, the argument to
the option indicated by keypublic void addOption(String option)
option
- the no-argument option to add to this objectpublic void addOption(String option, String value)
option
- the option to add to this objectvalue
- the argument to the optionpublic void addOptionIfValueNonEmpty(String option, String value)
option
- the option to add to this objectvalue
- the argument to the option (or null)public void addOptions(Map<String,String> options)
options
- the options to add to this objectpublic Map<String,String> getOptions()