public class DefaultOption extends ParentImpl
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_BURST_ENABLED
The default value for the burstEnabled constructor parameter
|
static java.lang.String |
DEFAULT_LONG_PREFIX
The default token used to prefix a long option
|
static java.lang.String |
DEFAULT_SHORT_PREFIX
The default token used to prefix a short option
|
| Constructor and Description |
|---|
DefaultOption(java.lang.String shortPrefix,
java.lang.String longPrefix,
boolean burstEnabled,
java.lang.String preferredName,
java.lang.String description,
java.util.Set aliases,
java.util.Set burstAliases,
boolean required,
Argument argument,
Group children,
int id)
Creates a new DefaultOption
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendUsage(java.lang.StringBuffer buffer,
java.util.Set helpSettings,
java.util.Comparator comp)
Appends usage information to the specified StringBuffer
|
boolean |
canProcess(WriteableCommandLine commandLine,
java.lang.String argument)
Indicates whether this Option will be able to process the particular
argument.
|
java.lang.String |
getPreferredName()
The preferred name of an option is used for generating help and usage
information.
|
java.util.Set |
getPrefixes()
Identifies the argument prefixes that should be considered options.
|
java.util.Set |
getTriggers()
Identifies the argument prefixes that should trigger this option.
|
void |
processParent(WriteableCommandLine commandLine,
java.util.ListIterator arguments)
Process the parent.
|
void |
validate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this
option.
|
defaults, findOption, getArgument, getChildren, getDescription, helpLines, processcanProcess, checkPrefixes, equals, getId, hashCode, isRequired, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcanProcess, getId, isRequiredpublic static final java.lang.String DEFAULT_SHORT_PREFIX
public static final java.lang.String DEFAULT_LONG_PREFIX
public static final boolean DEFAULT_BURST_ENABLED
public DefaultOption(java.lang.String shortPrefix, java.lang.String longPrefix, boolean burstEnabled, java.lang.String preferredName, java.lang.String description, java.util.Set aliases, java.util.Set burstAliases, boolean required, Argument argument, Group children, int id) throws java.lang.IllegalArgumentException
shortPrefix - the prefix used for short optionslongPrefix - the prefix used for long optionsburstEnabled - should option bursting be enabledpreferredName - the preferred name for this Option, this should
begin with either shortPrefix or longPrefixdescription - a description of this Optionaliases - the alternative names for this OptionburstAliases - the aliases that can be burstrequired - whether the Option is strictly requiredargument - the Argument belonging to this Parent, or nullchildren - the Group children belonging to this Parent, ot nullid - the unique identifier for this Optionjava.lang.IllegalArgumentException - if the preferredName or an alias isn't
prefixed with shortPrefix or longPrefixpublic boolean canProcess(WriteableCommandLine commandLine, java.lang.String argument)
canProcess in interface OptioncanProcess in class ParentImplcommandLine - the CommandLine object to store defaults inargument - the argument to be testedpublic void processParent(WriteableCommandLine commandLine, java.util.ListIterator arguments) throws OptionException
commandLine - the CommandLine object to store defaults inarguments - the ListIterator over String argumentsOptionException - if an error occursOption.process(WriteableCommandLine, ListIterator)public java.util.Set getTriggers()
public java.util.Set getPrefixes()
getPrefixes in interface OptiongetPrefixes in class ParentImplpublic void validate(WriteableCommandLine commandLine) throws OptionException
validate in interface Optionvalidate in class ParentImplcommandLine - the CommandLine to check.OptionException - if the CommandLine is not valid.public void appendUsage(java.lang.StringBuffer buffer, java.util.Set helpSettings, java.util.Comparator comp)
appendUsage in interface OptionappendUsage in class ParentImplbuffer - the buffer to append tohelpSettings - a set of display settings @see DisplaySettingcomp - a comparator used to sort the Optionspublic java.lang.String getPreferredName()