public class Switch extends ParentImpl
+d|-d
or --enable-x|--disable-x
.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DISABLED_PREFIX
The default prefix for disabled switches
|
static String |
DEFAULT_ENABLED_PREFIX
The default prefix for enabled switches
|
static ResourceHelper |
resources
i18n
|
Constructor and Description |
---|
Switch(String enabledPrefix,
String disabledPrefix,
String preferredName,
Set aliases,
String description,
boolean required,
Argument argument,
Group children,
int id,
Boolean switchDefault)
Creates a new Switch with the specified parameters
|
Modifier and Type | Method and Description |
---|---|
void |
appendUsage(StringBuffer buffer,
Set helpSettings,
Comparator comp)
Appends usage information to the specified StringBuffer
|
void |
defaults(WriteableCommandLine commandLine)
Adds defaults to a CommandLine.
|
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)
Processes the parent part of the Option.
|
void |
validate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this
option.
|
canProcess, findOption, getArgument, getChildren, getDescription, 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 static final ResourceHelper resources
public static final String DEFAULT_ENABLED_PREFIX
public static final String DEFAULT_DISABLED_PREFIX
public Switch(String enabledPrefix, String disabledPrefix, String preferredName, Set aliases, String description, boolean required, Argument argument, Group children, int id, Boolean switchDefault)
enabledPrefix
- the prefix used for enabled switchesdisabledPrefix
- the prefix used for disabled switchespreferredName
- the preferred name of the switchaliases
- the aliases by which the Switch is knowndescription
- a description of the Switchrequired
- 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 OptionIllegalArgumentException
- if the preferredName or an alias isn't
prefixed with enabledPrefix or disabledPrefixpublic 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 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(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
public void defaults(WriteableCommandLine commandLine)
Option
defaults
in interface Option
defaults
in class ParentImpl
commandLine
- The CommandLine object to store defaults inCopyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.