public class Switch extends ParentImpl
+d|-d or --enable-x|--disable-x.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_DISABLED_PREFIX
The default prefix for disabled switches
|
static java.lang.String |
DEFAULT_ENABLED_PREFIX
The default prefix for enabled switches
|
static ResourceHelper |
RESOURCES
i18n
|
| Constructor and Description |
|---|
Switch(java.lang.String enabledPrefix,
java.lang.String disabledPrefix,
java.lang.String preferredName,
java.util.Set aliases,
java.lang.String description,
boolean required,
Argument argument,
Group children,
int id,
java.lang.Boolean switchDefault)
Creates a new Switch with the specified parameters
|
| 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
|
void |
defaults(WriteableCommandLine commandLine)
Adds defaults to a CommandLine.
|
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.
|
canProcess, findOption, getArgument, getChildren, getDescription, helpLines, processcanProcess, checkPrefixes, equals, getId, hashCode, isRequired, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcanProcess, getId, isRequiredpublic static final ResourceHelper RESOURCES
public static final java.lang.String DEFAULT_ENABLED_PREFIX
public static final java.lang.String DEFAULT_DISABLED_PREFIX
public Switch(java.lang.String enabledPrefix, java.lang.String disabledPrefix, java.lang.String preferredName, java.util.Set aliases, java.lang.String description, boolean required, Argument argument, Group children, int id, java.lang.Boolean switchDefault) throws java.lang.IllegalArgumentException
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 OptionswitchDefault - the switch default valuejava.lang.IllegalArgumentException - if the preferredName or an alias isn't
prefixed with enabledPrefix or disabledPrefixpublic void processParent(WriteableCommandLine commandLine, java.util.ListIterator arguments) throws OptionException
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 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()
public void defaults(WriteableCommandLine commandLine)
defaults in interface Optiondefaults in class ParentImplcommandLine - the CommandLine object to store defaults in