public class LoaderOptions extends Options
[-option] ... file_name
The options defined by this class are:
-v | If this option is present then the command line program will display comprehensive feedback as it executes. |
-d | If this flag is present then comprehensive debug information will be logged to the appropriate log file. |
Some examples (that include the program to run):
load_device_map -d device_service_map
load_business_params -d -v business_params
If you have additional options that are unique to your program then you will need to extend this class to support those options. The bulk of the extension can be achieved by adding option definitions for your new options in the constructor of your derived class. See the Options class for an example on how to do this.
Options.DateOptionDef, Options.DecimalOptionDef, Options.FlagOptionDef, Options.IntOptionDef, Options.OptionDef, Options.StringOptionDef
CommandLineParser.InvalidOptionsException, CommandLineParser.NoSuchOptionException, CommandLineParser.OptionDataException, CommandLineParser.OptionException, CommandLineParser.ValueOutOfBoundsException
Modifier and Type | Field and Description |
---|---|
static String |
DEBUG
The debug option.
|
static String |
VERBOSE
The verbose option.
|
ALL
Modifier | Constructor and Description |
---|---|
protected |
LoaderOptions(String[] args)
You cannot all this constructor directly because you must derive from
this class.
|
Modifier and Type | Method and Description |
---|---|
static LoaderOptions |
createLoaderOptions(String[] args)
Factory method used to create a LoaderOptions.
|
static LoaderOptions |
createLoaderOptionsAndExitOnErrorOrHelp(String[] args)
Factory method used to create a LoaderOptions.
|
String |
getFileName()
Convienence method to return the name of the file to load
configuration information into Portal.
|
protected String |
getSyntaxHelp()
Get the help string that describes the syntax required by your options
class.
|
boolean |
isDebug()
Convienence method to return the state of the debug option.
|
boolean |
isVerbose()
Convienence method to return the state of the verbose option.
|
protected void |
postParse()
This method is called by the
CommandLineParser.parse
method after it has successfully parsed the command line. |
addOptionDef, getBigDecimal, getBoolean, getDate, getHelp, getInteger, getOptionDef, getOptValues, getString, getStrings, isHelp, storeAllTokensAsLeadingTokens, toString, validateLeadingTokens, validateOption, validateRequiredParameters, validateTrailingTokens
constructErrMsg, constructErrMsg, containsOption, createParser, getArgs, getLeadingToken, getLeadingTokens, getNumLeadingTokens, getNumOptions, getNumTrailingTokens, getNumValues, getStrFromBundle, getStrFromBundle, getTrailingToken, getTrailingTokens, getValue, getValues, getValues, parse, strArrayToString
public static final String VERBOSE
public static final String DEBUG
protected LoaderOptions(String[] args) throws CommandLineParser.InvalidOptionsException
CommandLineParse.parse
method after your
constructor has finished all initialization. This is because
the CommandLineParser.parse
method calls the methods
overriden in the Options class which depend on the
option definitions defined in the constructor of your
derived class. All constructor initialization must be complete for
the CommandLineParser.parse
method to work correctly.
args
- The array of command line arguments passed to the program.InvalidOptionsException
- An error was encountered when
parsing the command line arguments. See the Options
constructor for details on the possible various errors encountered.CommandLineParser.InvalidOptionsException
public static LoaderOptions createLoaderOptions(String[] args) throws CommandLineParser.InvalidOptionsException
args
- The array of command line arguments passed to the program.InvalidOptionsException
- An error was encountered when
parsing the command line arguments. See the Options
constructor for details on the possible various errors encountered.CommandLineParser.InvalidOptionsException
public static LoaderOptions createLoaderOptionsAndExitOnErrorOrHelp(String[] args)
args
- The array of command line arguments passed to the program.public boolean isDebug()
containsOption(mDebug)
.
public boolean isVerbose()
containsOption(mVerbose)
.
public String getFileName()
protected String getSyntaxHelp()
getSyntaxHelp
in class Options
protected void postParse() throws CommandLineParser.InvalidOptionsException
CommandLineParser.parse
method after it has successfully parsed the command line. Typically,
this is the place where you extract option values into local member
variables.
postParse
in class CommandLineParser
InvalidOptionsException
- An error was detected when extracting
option values into local member variables.CommandLineParser.InvalidOptionsException
Copyright © 2003, 2023, Oracle and/or its affiliates.