argName
private static String argName
argument name
description
private static String description
option description
instance
private static OptionBuilder instance
option builder instance
longopt
private static String longopt
long option
numberOfArgs
private static int numberOfArgs
the number of arguments
optionalArg
private static boolean optionalArg
option can have an optional argument value
required
private static boolean required
is required?
type
private static Object type
option type
valuesep
private static char valuesep
value separator for argument value
create
public static Option create()
throws IllegalArgumentException
Create an Option using the current settings
create
public static Option create(String opt)
throws IllegalArgumentException
Create an Option using the current settings and with
the specified Option char
.
opt
- the java.lang.String
representation
of the Option
create
public static Option create(char opt)
throws IllegalArgumentException
Create an Option using the current settings and with
the specified Option char
.
opt
- the character representation of the Option
hasArg
public static OptionBuilder hasArg()
The next Option created will require an argument value.
- the OptionBuilder instance
hasArg
public static OptionBuilder hasArg(boolean hasArg)
The next Option created will require an argument value if
hasArg
is true.
hasArg
- if true then the Option has an argument value
- the OptionBuilder instance
hasArgs
public static OptionBuilder hasArgs()
The next Option created can have unlimited argument values.
- the OptionBuilder instance
hasArgs
public static OptionBuilder hasArgs(int num)
The next Option created can have num
argument values.
num
- the number of args that the option can have
- the OptionBuilder instance
hasOptionalArg
public static OptionBuilder hasOptionalArg()
The next Option can have an optional argument.
- the OptionBuilder instance
hasOptionalArgs
public static OptionBuilder hasOptionalArgs()
The next Option can have an unlimited number of
optional arguments.
- the OptionBuilder instance
hasOptionalArgs
public static OptionBuilder hasOptionalArgs(int numArgs)
The next Option can have the specified number of
optional arguments.
numArgs
- - the maximum number of optional arguments
the next Option created can have.
- the OptionBuilder instance
isRequired
public static OptionBuilder isRequired()
The next Option created will be required.
- the OptionBuilder instance
isRequired
public static OptionBuilder isRequired(boolean required)
The next Option created will be required if required
is true.
required
- if true then the Option is required
- the OptionBuilder instance
reset
private static void reset()
Resets the member variables to their default values.
withArgName
public static OptionBuilder withArgName(String name)
The next Option created will have the specified argument value
name.
name
- the name for the argument value
- the OptionBuilder instance
withDescription
public static OptionBuilder withDescription(String description)
The next Option created will have the specified description
description
- a description of the Option's purpose
- the OptionBuilder instance
withLongOpt
public static OptionBuilder withLongOpt(String longopt)
The next Option created will have the following long option value.
longopt
- the long option value
- the OptionBuilder instance
withType
public static OptionBuilder withType(Object type)
The next Option created will have a value that will be an instance
of type
.
type
- the type of the Options argument value
- the OptionBuilder instance
withValueSeparator
public static OptionBuilder withValueSeparator()
The next Option created uses '
=
' as a means to
separate argument values.
Example:
Option opt = OptionBuilder.withValueSeparator( )
.create( 'D' );
CommandLine line = parser.parse( args );
String propertyName = opt.getValue( 0 );
String propertyValue = opt.getValue( 1 );
- the OptionBuilder instance
withValueSeparator
public static OptionBuilder withValueSeparator(char sep)
The next Option created uses
sep
as a means to
separate argument values.
Example:
Option opt = OptionBuilder.withValueSeparator( ':' )
.create( 'D' );
CommandLine line = parser.parse( args );
String propertyName = opt.getValue( 0 );
String propertyValue = opt.getValue( 1 );
- the OptionBuilder instance