|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafe.Options
This is the super-class of classes that hold the values of command-line options. The options are separated from the Main class to improve modularity and to allow the options to be reset during a single execution of the main program. Consequently, none of the options fields should be static. The program may hold a static instance of an Options object if it wishes.
Derived classes should define overriding methods for
Field Summary | |
boolean |
assertionsEnabled
Java allows assertions to be enabled and disabled. |
boolean |
assertIsKeyword
Are we parsing Java 1.4 source code (i.e., we must parse the new "assert" Java keyword). |
java.lang.String |
currentdir
Option holding the current working directory. |
static java.lang.String |
eol
|
int |
fileOrigin
|
java.util.ArrayList |
inputEntries
Holds all the non-option arguments. |
boolean |
issueUsage
True if we should simply issue a usage message and abort. |
static int |
NEVER_BINARY
|
static int |
NEVER_SOURCE
|
boolean |
noCautions
Option to turn off caution warnings. |
static int |
PREFER_BINARY
Flags to use or not use source or binary files. |
static int |
PREFER_RECENT
|
static int |
PREFER_SOURCE
|
(package private) java.lang.String[][] |
privateOptionData
|
(package private) java.lang.String[][] |
publicOptionData
|
boolean |
quiet
Option to restrict output to error/caution/warning messages only - no progress or informational output. |
boolean |
showErrorLocation
Debugging flag used to turn on stack trace dumps when error messages are issued. |
java.lang.String |
sysPath
Option holding the user-specified boot classpath. |
boolean |
testMode
When true, no variable output (e.g., execution time) is printed, so that output can be compared to an oracle output file. |
java.lang.String |
userPath
Option holding the user-specified classpath. |
java.lang.String |
userSourcePath
Option holding the user-specified sourcepath. |
boolean |
v
Option to generate lots of output indicating what is happening during execution. |
Constructor Summary | |
Options()
|
Method Summary | |
protected void |
checkMoreArguments(java.lang.String option,
java.lang.String[] args,
int offset)
|
java.lang.String |
format(java.lang.String[] sa)
|
void |
processFileOfArgs(java.lang.String filename)
|
int |
processOption(java.lang.String option,
java.lang.String[] args,
int offset)
Process next tool option. |
void |
processOptions(java.lang.String[] args)
Process tool options contained in args . |
protected void |
processOptionsLoop(java.lang.String[] args)
|
java.lang.String |
showNonOptions()
|
java.lang.String |
showOptionArray(java.lang.String[][] data)
|
java.lang.String |
showOptions(boolean all)
Return option information in a string where each line is preceeded by two blank spaces and followed by a line separator. |
void |
usage(java.lang.String name)
Print our usage message to System.err . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.util.ArrayList inputEntries
public boolean quiet
public boolean v
public boolean testMode
public boolean noCautions
public java.lang.String currentdir
public java.lang.String userPath
public java.lang.String userSourcePath
public java.lang.String sysPath
public boolean issueUsage
public boolean assertIsKeyword
public boolean assertionsEnabled
public boolean showErrorLocation
public static final int PREFER_BINARY
public static final int PREFER_SOURCE
public static final int PREFER_RECENT
public static final int NEVER_BINARY
public static final int NEVER_SOURCE
public int fileOrigin
final java.lang.String[][] publicOptionData
final java.lang.String[][] privateOptionData
public static final java.lang.String eol
Constructor Detail |
public Options()
Method Detail |
public final void processOptions(java.lang.String[] args) throws UsageError
args
.
args
- the command-line arguments that are being processed.
UsageError
- If the option is erroneous, throw an
UsageError
exception with a string describing the
problem.protected final void processOptionsLoop(java.lang.String[] args) throws UsageError
UsageError
public int processOption(java.lang.String option, java.lang.String[] args, int offset) throws UsageError
This routine handles the standard front-end options, storing the
resulting information in the preceding instance variables and
Info.on
.
option
- the option currently being handled. An option
always starts with a '-' character, and the remaining
command-line arguments (not counting option
)
(args[offset]
,...,args[args.length-1]
).args
- the command-line arguments that are being processed.offset
- the offset into the args array that
indicates which option is currently being dealt with.
- Returns:
- The offset to any remaining command-line arguments
should be returned. (This allows the option to consume some or
all of the following arguments.)
- Throws:
UsageError
- If the option is erroneous, throw an
UsageError
exception with a string describing the
problem.- Design:
- When this routine is overridden, the new method body should
always end with
return super.processOption(option, args,
offset)
.
protected void checkMoreArguments(java.lang.String option, java.lang.String[] args, int offset) throws UsageError
UsageError
public void processFileOfArgs(java.lang.String filename) throws UsageError
UsageError
public void usage(java.lang.String name)
System.err
.
name
- the name of the tool whose options we are printing.public java.lang.String showNonOptions()
public java.lang.String showOptions(boolean all)
all
- if true, then all options are printed, including
experimental options; otherwise, just the options expected to
be used by standard users are printed.
super.showOptions()
.public java.lang.String showOptionArray(java.lang.String[][] data)
public java.lang.String format(java.lang.String[] sa)
|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |