|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.cli2.option.OptionImpl
org.apache.commons.cli2.option.ParentImpl
org.apache.commons.cli2.option.DefaultOption
public class DefaultOption
A Parent implementation representing normal options.
Field Summary | |
---|---|
private java.util.Set |
aliases
|
private java.util.Set |
burstAliases
|
private boolean |
burstEnabled
|
private int |
burstLength
|
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 |
private java.lang.String |
preferredName
|
private java.util.Set |
prefixes
|
private java.lang.String |
shortPrefix
|
private java.util.Set |
triggers
|
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
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)
Processes the parent part of the Option. |
void |
validate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this option. |
Methods inherited from class org.apache.commons.cli2.option.ParentImpl |
---|
defaults, findOption, getArgument, getChildren, getDescription, helpLines, process |
Methods inherited from class org.apache.commons.cli2.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 org.apache.commons.cli2.Option |
---|
canProcess, getId, isRequired |
Field Detail |
---|
public static final java.lang.String DEFAULT_SHORT_PREFIX
public static final java.lang.String DEFAULT_LONG_PREFIX
public static final boolean DEFAULT_BURST_ENABLED
private final java.lang.String preferredName
private final java.util.Set aliases
private final java.util.Set burstAliases
private final java.util.Set triggers
private final java.util.Set prefixes
private final java.lang.String shortPrefix
private final boolean burstEnabled
private final int burstLength
Constructor Detail |
---|
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)
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
java.lang.IllegalArgumentException
- if the preferredName or an alias isn't
prefixed with shortPrefix or longPrefixMethod Detail |
---|
public boolean canProcess(WriteableCommandLine commandLine, java.lang.String argument)
Option
canProcess
in interface Option
canProcess
in class ParentImpl
argument
- The argument to be tested
public void processParent(WriteableCommandLine commandLine, java.util.ListIterator arguments) throws OptionException
Parent
commandLine
- the CommandLine to write results toarguments
- a ListIterator over argument strings positioned at the next
argument to process
OptionException
- if an error occurs while processingOption.process(WriteableCommandLine, ListIterator)
public java.util.Set getTriggers()
Option
public java.util.Set getPrefixes()
Option
getPrefixes
in interface Option
getPrefixes
in class ParentImpl
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(java.lang.StringBuffer buffer, java.util.Set helpSettings, java.util.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 java.lang.String getPreferredName()
Option
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |