Package org.openstreetmap.josm.gui
Class ProgramArguments
- java.lang.Object
-
- org.openstreetmap.josm.gui.ProgramArguments
-
public class ProgramArguments extends Object
This class holds the arguments passed on toMainApplication.main(java.lang.String[])
.- Since:
- 10899
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProgramArguments.Option
JOSM command line options.
-
Field Summary
Fields Modifier and Type Field Description private Map<ProgramArguments.Option,List<String>>
argMap
-
Constructor Summary
Constructors Constructor Description ProgramArguments(String... args)
Construct the program arguments object
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addOption(ProgramArguments.Option opt, String optarg)
private void
buildCommandLineArgumentMap(String... args)
Builds the command-line argument map.Collection<String>
get(ProgramArguments.Option option)
Gets all values that are given for a given optionLevel
getLogLevel()
Get the log level the user wants us to use.Map<String,String>
getPreferencesToSet()
Gets a map of all preferences the user wants to set.Optional<String>
getSingle(ProgramArguments.Option option)
Gets a single argument (the first) that was given for the given option.private static String
getValue(String... kv)
boolean
hasOption(ProgramArguments.Option option)
Test if a given option was used by the user.boolean
showHelp()
Helper method to indicate if help should be displayed.boolean
showVersion()
Helper method to indicate if version should be displayed.
-
-
-
Field Detail
-
argMap
private final Map<ProgramArguments.Option,List<String>> argMap
-
-
Constructor Detail
-
ProgramArguments
public ProgramArguments(String... args)
Construct the program arguments object- Parameters:
args
- The args passed to main.- Since:
- 10936
-
-
Method Detail
-
buildCommandLineArgumentMap
private void buildCommandLineArgumentMap(String... args)
Builds the command-line argument map.- Parameters:
args
- command-line arguments array
-
addOption
private void addOption(ProgramArguments.Option opt, String optarg)
-
getSingle
public Optional<String> getSingle(ProgramArguments.Option option)
Gets a single argument (the first) that was given for the given option.- Parameters:
option
- The option to search- Returns:
- The argument as optional value.
-
get
public Collection<String> get(ProgramArguments.Option option)
Gets all values that are given for a given option- Parameters:
option
- The option- Returns:
- The values that were given. May be empty.
-
hasOption
public boolean hasOption(ProgramArguments.Option option)
Test if a given option was used by the user.- Parameters:
option
- The option to test for- Returns:
true
if the user used it.
-
showVersion
public boolean showVersion()
Helper method to indicate if version should be displayed.- Returns:
true
to display version
-
showHelp
public boolean showHelp()
Helper method to indicate if help should be displayed.- Returns:
true
to display version
-
getLogLevel
public Level getLogLevel()
Get the log level the user wants us to use.- Returns:
- The log level.
-
getPreferencesToSet
public Map<String,String> getPreferencesToSet()
Gets a map of all preferences the user wants to set.- Returns:
- The preferences to set. It contains null values for preferences to unset
-
-