|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.dpml.cli.option.OptionImpl net.dpml.cli.option.ParentImpl net.dpml.cli.option.DefaultOption
A Parent implementation representing normal options.
Field Summary | |
static boolean |
DEFAULT_BURST_ENABLED
The default value for the burstEnabled constructor parameter |
static String |
DEFAULT_LONG_PREFIX
The default token used to prefix a long option |
static String |
DEFAULT_SHORT_PREFIX
The default token used to prefix a short option |
Constructor Summary | |
DefaultOption(String shortPrefix,
String longPrefix,
boolean burstEnabled,
String preferredName,
String description,
Set aliases,
Set burstAliases,
boolean required,
Argument argument,
Group children,
int id)
Creates a new DefaultOption |
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. |
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. |
Set |
getTriggers()
Identifies the argument prefixes that should trigger this option. |
void |
processParent(WriteableCommandLine commandLine,
ListIterator arguments)
Process the parent. |
void |
validate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this option. |
Methods inherited from class net.dpml.cli.option.ParentImpl |
defaults, findOption, getArgument, getChildren, getDescription, helpLines, process |
Methods inherited from class net.dpml.cli.option.OptionImpl |
canProcess, checkPrefixes, equals, getId, hashCode, isRequired, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.dpml.cli.Option |
canProcess, getId, isRequired |
Field Detail |
public static final String DEFAULT_SHORT_PREFIX
public static final String DEFAULT_LONG_PREFIX
public static final boolean DEFAULT_BURST_ENABLED
Constructor Detail |
public DefaultOption(String shortPrefix, String longPrefix, boolean burstEnabled, String preferredName, String description, Set aliases, Set burstAliases, boolean required, Argument argument, Group children, int id) throws 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 Option
IllegalArgumentException
- if the preferredName or an alias isn't
prefixed with shortPrefix or longPrefixMethod Detail |
public boolean canProcess(WriteableCommandLine commandLine, String argument)
canProcess
in interface Option
canProcess
in class ParentImpl
commandLine
- the CommandLine object to store defaults inargument
- the argument to be tested
public void processParent(WriteableCommandLine commandLine, ListIterator arguments) throws OptionException
commandLine
- the CommandLine object to store defaults inarguments
- the ListIterator over String arguments
OptionException
- if an error occursOption.process(WriteableCommandLine, ListIterator)
public Set getTriggers()
public Set getPrefixes()
getPrefixes
in interface Option
getPrefixes
in class ParentImpl
public void validate(WriteableCommandLine commandLine) throws OptionException
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)
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()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |