public class Command extends ParentImpl
Constructor and Description |
---|
Command(String preferredName,
String description,
Set aliases,
boolean required,
Argument argument,
Group children,
int id)
Creates a new Command instance.
|
Modifier and Type | Method and Description |
---|---|
void |
appendUsage(StringBuffer buffer,
Set helpSettings,
Comparator comp)
Appends usage information to the specified StringBuffer
|
String |
getPreferredName()
The preferred name of an option is used for generating help and usage
information.
|
Set |
getTriggers()
Identifies the argument prefixes that should trigger this option.
|
void |
processParent(WriteableCommandLine commandLine,
ListIterator arguments)
Processes the parent part of the Option.
|
void |
validate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this
option.
|
canProcess, defaults, findOption, getArgument, getChildren, getDescription, getPrefixes, helpLines, process
canProcess, checkPrefixes, equals, getId, getParent, hashCode, isRequired, setParent, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
canProcess, getId, getParent, isRequired, setParent
public Command(String preferredName, String description, Set aliases, boolean required, Argument argument, Group children, int id)
preferredName
- The name normally used to refer to the Commanddescription
- A description of the Commandaliases
- Alternative names for the Commandrequired
- Whether the Command is requiredargument
- An Argument that the command takeschildren
- The Group of child options for this Commandid
- A unique id for the CommandParentImpl.ParentImpl(Argument, Group, String, int, boolean)
public void processParent(WriteableCommandLine commandLine, ListIterator arguments) throws OptionException
Parent
commandLine
- the CommandLine to write results toarguments
- a ListIterator over argument strings positioned at the next
argument to processOptionException
- if an error occurs while processingOption.process(WriteableCommandLine, ListIterator)
public Set getTriggers()
Option
public void validate(WriteableCommandLine commandLine) throws OptionException
Option
validate
in interface Option
validate
in class ParentImpl
commandLine
- The CommandLine to check.OptionException
- if the CommandLine is not valid.public void appendUsage(StringBuffer buffer, Set helpSettings, Comparator comp)
Option
appendUsage
in interface Option
appendUsage
in class ParentImpl
buffer
- the buffer to append tohelpSettings
- a set of display settings @see DisplaySettingcomp
- a comparator used to sort the Optionspublic String getPreferredName()
Option
Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.