|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjasm.util.OptArg
public final class OptArg
A small utility for parsing command-line options. It helps to take some of the hassle out of building the front-end of a Whiley compiler.
Field Summary | |
---|---|
jasm.util.OptArg.Kind |
argument
The kind of argument accepted by this option (if any). |
java.lang.Object |
defaultValue
A default value for the option (assuming it accepts an argument). |
java.lang.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
|
java.lang.String |
option
The long form of the option. |
java.lang.String |
shortForm
The short form of the option. |
static jasm.util.OptArg.STRING |
STRING
|
Constructor Summary | |
---|---|
OptArg(java.lang.String option,
jasm.util.OptArg.Kind argument,
java.lang.String description)
Construct an option object which accepts an argument. |
|
OptArg(java.lang.String option,
jasm.util.OptArg.Kind argument,
java.lang.String description,
java.lang.Object defaultValue)
Construct an option object which accepts an argument and has a default value. |
|
OptArg(java.lang.String option,
java.lang.String description)
Construct an option object which does not accept an argument. |
|
OptArg(java.lang.String option,
java.lang.String shortForm,
jasm.util.OptArg.Kind argument,
java.lang.String description)
Construct an option object with a short form which accepts an argument. |
|
OptArg(java.lang.String option,
java.lang.String shortForm,
jasm.util.OptArg.Kind argument,
java.lang.String description,
java.lang.Object defaultValue)
Construct an option object with a short form which accepts an argument and has a default value. |
|
OptArg(java.lang.String option,
java.lang.String shortForm,
java.lang.String description)
Construct an option object with a short form which does not accept an argument. |
Method Summary | |
---|---|
static java.util.Map<java.lang.String,java.lang.Object> |
parseOptions(java.util.List<java.lang.String> args,
OptArg... options)
Parse options from the list of arguments, removing those which are recognised. |
static void |
usage(java.io.PrintStream output,
OptArg... options)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final java.lang.String option
public final java.lang.String shortForm
public final jasm.util.OptArg.Kind argument
public final java.lang.String description
public final java.lang.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
Constructor Detail |
---|
public OptArg(java.lang.String option, java.lang.String description)
option
- argument
- description
- defaultValue
- public OptArg(java.lang.String option, java.lang.String shortForm, java.lang.String description)
option
- shortForm
- argument
- description
- defaultValue
- public OptArg(java.lang.String option, jasm.util.OptArg.Kind argument, java.lang.String description)
option
- argument
- description
- defaultValue
- public OptArg(java.lang.String option, java.lang.String shortForm, jasm.util.OptArg.Kind argument, java.lang.String description)
option
- shortForm
- argument
- description
- defaultValue
- public OptArg(java.lang.String option, jasm.util.OptArg.Kind argument, java.lang.String description, java.lang.Object defaultValue)
option
- argument
- description
- defaultValue
- public OptArg(java.lang.String option, java.lang.String shortForm, jasm.util.OptArg.Kind argument, java.lang.String description, java.lang.Object defaultValue)
option
- argument
- description
- defaultValue
- Method Detail |
---|
public static java.util.Map<java.lang.String,java.lang.Object> parseOptions(java.util.List<java.lang.String> args, OptArg... options)
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
processed
---
- a RuntimeException
if an unrecognised option is
encountered (that is, a token starting with '-')..public static void usage(java.io.PrintStream output, OptArg... options)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |