public final class OptArg extends Object
| Modifier and Type | Field and Description |
|---|---|
jasm.util.OptArg.Kind |
argument
The kind of argument accepted by this option (if any).
|
Object |
defaultValue
A default value for the option (assuming it accepts an argument).
|
String |
description
A description of the option.
|
static jasm.util.OptArg.FILE |
FILE |
static jasm.util.OptArg.FILEDIR |
FILEDIR |
static jasm.util.OptArg.FILELIST |
FILELIST |
static jasm.util.OptArg.INT |
INT |
String |
option
The long form of the option.
|
String |
shortForm
The short form of the option.
|
static jasm.util.OptArg.STRING |
STRING |
| Constructor and Description |
|---|
OptArg(String option,
jasm.util.OptArg.Kind argument,
String description)
Construct an option object which accepts an argument.
|
OptArg(String option,
jasm.util.OptArg.Kind argument,
String description,
Object defaultValue)
Construct an option object which accepts an argument and has a default value.
|
OptArg(String option,
String description)
Construct an option object which does not accept an argument.
|
OptArg(String option,
String shortForm,
jasm.util.OptArg.Kind argument,
String description)
Construct an option object with a short form which accepts an argument.
|
OptArg(String option,
String shortForm,
jasm.util.OptArg.Kind argument,
String description,
Object defaultValue)
Construct an option object with a short form which accepts an argument and has a default value.
|
OptArg(String option,
String shortForm,
String description)
Construct an option object with a short form which does not accept an
argument.
|
| Modifier and Type | Method and Description |
|---|---|
static Map<String,Object> |
parseOptions(List<String> args,
OptArg... options)
Parse options from the list of arguments, removing those which are
recognised.
|
static void |
usage(PrintStream output,
OptArg... options) |
public final String option
public final String shortForm
public final jasm.util.OptArg.Kind argument
public final String description
public final Object defaultValue
public static final jasm.util.OptArg.STRING STRING
public static final jasm.util.OptArg.INT INT
public static final jasm.util.OptArg.FILE FILE
public static final jasm.util.OptArg.FILEDIR FILEDIR
public static final jasm.util.OptArg.FILELIST FILELIST
public OptArg(String option, String description)
option - Long form of option (e.g. "version" for "-version").description - Description of the option.public OptArg(String option, String shortForm, String description)
option - Long form of option (e.g. "version" for "-version").shortForm - Short form of the option (e.g. "v" for "-v").description - Description of the option used for printing usage information.public OptArg(String option, jasm.util.OptArg.Kind argument, String description)
option - Long form of option (e.g. "version" for "-version").argument - Kind of argument accepted by this option (if any).description - Description of the option used for printing usage information.public OptArg(String option, String shortForm, jasm.util.OptArg.Kind argument, String description)
option - Long form of option (e.g. "version" for "-version").shortForm - Short form of the option (e.g. "v" for "-v").argument - Kind of argument accepted by this option (if any).description - Description of the option used for printing usage information.public OptArg(String option, jasm.util.OptArg.Kind argument, String description, Object defaultValue)
option - Long form of option (e.g. "version" for "-version").argument - Kind of argument accepted by this option (if any).description - Description of the option used for printing usage information.defaultValue. - Default value of argument, or null if no default value.public OptArg(String option, String shortForm, jasm.util.OptArg.Kind argument, String description, Object defaultValue)
option - Long form of option (e.g. "version" for "-version").shortForm - Short form of the option (e.g. "v" for "-v").argument - Kind of argument accepted by this option (if any).description - Description of the option used for printing usage information.defaultValue. - Default value of argument, or null if no default value.public static Map<String,Object> parseOptions(List<String> args, OptArg... options)
RuntimeException if an unrecognised option is encountered
(that is, a token starting with '-').args - --- the list of argument strings. This is modified by removing
those which are processed.options - --- the list of OptArg defining which options should be
processedpublic static void usage(PrintStream output, OptArg... options)
Copyright © 2016. All rights reserved.