net.dpml.cli.option
public class ArgumentImpl extends OptionImpl implements Argument
Version: @PROJECT-VERSION@
Field Summary | |
---|---|
static String | DEFAULT_CONSUME_REMAINING
The default token to indicate that remaining arguments should be consumed
as values. |
static char | DEFAULT_INITIAL_SEPARATOR
The default value for the initial separator char. |
static char | DEFAULT_SUBSEQUENT_SEPARATOR
The default value for the subsequent separator char. |
Constructor Summary | |
---|---|
ArgumentImpl(String name, String description, int minimum, int maximum, char initialSeparator, char subsequentSeparator, Validator validator, String consumeRemaining, List valueDefaults, int id)
Creates a new Argument instance.
|
Method Summary | |
---|---|
void | appendUsage(StringBuffer buffer, Set helpSettings, Comparator comp)
Appends usage information to the specified StringBuffer
|
boolean | canProcess(WriteableCommandLine commandLine, String argument)
Indicates whether this Option will be able to process the particular
argument.
|
void | defaults(WriteableCommandLine commandLine)
Adds defaults to a CommandLine.
|
void | defaultValues(WriteableCommandLine commandLine, Option option)
Adds defaults to a CommandLine.
|
String | getConsumeRemaining()
Return the consume remaining flag. |
List | getDefaultValues()
Return the list of default values. |
String | getDescription()
Returns a description of the option. |
char | getInitialSeparator()
Returns the initial separator character or
'\0' if no character has been set.
|
int | getMaximum()
Retrieves the maximum number of values acceptable for a valid Argument
|
int | getMinimum()
Retrieves the minimum number of values required for a valid Argument
|
String | getPreferredName()
The preferred name of an option is used for generating help and usage
information.
|
Set | getPrefixes()
Identifies the argument prefixes that should be considered options. |
char | getSubsequentSeparator()
Returns the subsequent separator character.
|
Set | getTriggers()
Identifies the argument prefixes that should trigger this option. |
Validator | getValidator()
Return the argument validator. |
List | helpLines(int depth, Set helpSettings, Comparator comp)
Builds up a list of HelpLineImpl instances to be presented by HelpFormatter.
|
boolean | isRequired()
Indicates whether argument values must be present for the CommandLine to
be valid.
|
void | process(WriteableCommandLine commandLine, ListIterator args)
Processes String arguments into a CommandLine.
|
void | processValues(WriteableCommandLine commandLine, ListIterator arguments, Option option)
Processes the "README" style element of the argument.
|
String | stripBoundaryQuotes(String token)
If there are any leading or trailing quotes remove them from the
specified token.
|
void | validate(WriteableCommandLine commandLine)
Performs any necessary validation on the values added to the
CommandLine.
|
void | validate(WriteableCommandLine commandLine, Option option)
Performs any necessary validation on the values added to the
CommandLine.
|
Parameters: name the name of the argument description a description of the argument minimum the minimum number of values needed to be valid maximum the maximum number of values allowed to be valid initialSeparator the char separating option from value subsequentSeparator the char separating values from each other validator object responsible for validating the values consumeRemaining String used for the "consuming option" group valueDefaults values to be used if none are specified. id the id of the option, 0 implies automatic assignment.
See Also: OptionImpl
Parameters: buffer the buffer to append to helpSettings a set of display settings @see DisplaySetting comp a comparator used to sort the Options
Parameters: commandLine the CommandLine object to store defaults in argument the argument to be tested
Returns: true if the argument can be processed by this Option
Parameters: commandLine the CommandLine object to store defaults in.
Parameters: commandLine the CommandLine object to store defaults in. option the Option to store the defaults against.
Returns: the consume remaining flag
Returns: the default values
Returns: a description of the option.
See Also: HelpFormatter
Returns: char the initial separator character
Returns: the maximum number of values
Returns: the minimum number of values
Returns: The preferred name of the option
Returns: The set of prefixes for this Option
Returns: the subsequent separator character
Returns: The set of triggers for this Option
Returns: the validator
Parameters: depth the initial indent depth helpSettings the HelpSettings that should be applied comp a comparator used to sort options when applicable.
Returns: a List of HelpLineImpl objects
See Also: HelpLine HelpFormatter
Returns: true iff the CommandLine will be invalid without at least one value
See Also: getMinimum getMaximum
Parameters: commandLine the CommandLine object to store results in args the arguments to process
Throws: OptionException if any problems occur
Parameters: commandLine The CommandLine object to store results in. arguments The arguments to process. option The option to register value against.
Throws: OptionException if any problems occur.
Parameters: token the token to strip leading and trailing quotes
Returns: String the possibly modified token
Parameters: commandLine The CommandLine object to query.
Throws: OptionException if any problems occur.
Parameters: commandLine The CommandLine object to query. option The option to lookup values with.
Throws: OptionException if any problems occur.