public final class CmdLnOption
extends java.lang.Object
Constructor and Description |
---|
CmdLnOption(char[] shortNames) |
CmdLnOption(java.lang.Character shortName) |
CmdLnOption(java.lang.String longName) |
CmdLnOption(java.lang.String[] longNames) |
CmdLnOption(java.lang.String[] longNames,
char[] shortNames) |
CmdLnOption(java.lang.String longName,
java.lang.Character shortName) |
Modifier and Type | Method and Description |
---|---|
CmdLnOption |
addLongName(java.lang.String name) |
CmdLnOption |
addLongNames(java.util.Collection<java.lang.String> longNames) |
CmdLnOption |
addLongNames(java.lang.String[] longNames) |
CmdLnOption |
addShortName(java.lang.Character name) |
CmdLnOption |
addShortNames(char[] shortNames) |
CmdLnOption |
addShortNames(java.lang.Character[] shortNames) |
CmdLnOption |
addShortNames(java.util.Collection<java.lang.Character> shortNames) |
java.lang.String |
getDescription() |
java.lang.Object |
getUserObject()
An object that may be set by the user.
|
CmdLnOption |
setArgumentBounds(int minArguments,
int maxArguments)
Sets the bounds for command line arguments.
|
CmdLnOption |
setDescription(java.lang.String description) |
CmdLnOption |
setListener(CmdLnListener callback)
Set the call back object
|
CmdLnOption |
setNoArguments()
Sets the argument bounds to require no arguments
(zero arguments minimum, zero arguments maximum).
|
CmdLnOption |
setOptionalArgument()
Sets the argument bounds for a single optional argument
(zero arguments minimum, one argument maximum).
|
CmdLnOption |
setRequiredArgument()
Sets the argument bounds for a single required argument
(one argument minimum, one argument maximum).
|
CmdLnOption |
setUnlimitedArguments()
Sets the argument bounds for unlimited (but optional) arguments
(zero arguments minimum, Integer.MAX_VALUE arguments maximum).
|
CmdLnOption |
setUserObject(java.lang.Object userObject)
An object that may be set by the user.
|
java.lang.String |
toString()
Get a short string description this option.
|
public CmdLnOption(java.lang.String[] longNames)
longNames
- list long names for this optionjava.lang.IllegalArgumentException
- if the the list does not contain at least one long namepublic CmdLnOption(char[] shortNames)
shortNames
- list short names for this optionjava.lang.IllegalArgumentException
- if the the list does not contain at least one short namepublic CmdLnOption(java.lang.String longName)
longName
- the long name for this optionjava.lang.IllegalArgumentException
- if the name is nullpublic CmdLnOption(java.lang.Character shortName)
shortName
- the short name for this optionpublic CmdLnOption(java.lang.String[] longNames, char[] shortNames)
longNames
- list long names for this optionshortNames
- list short names for this optionjava.lang.IllegalArgumentException
- if the the lists do not contain at least one namepublic CmdLnOption(java.lang.String longName, java.lang.Character shortName)
longName
- the long name for this optionshortName
- the short name for this optionpublic CmdLnOption setNoArguments()
java.lang.IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption setOptionalArgument()
java.lang.IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption setRequiredArgument()
java.lang.IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption setUnlimitedArguments()
java.lang.IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption setArgumentBounds(int minArguments, int maxArguments)
minArguments
- the minimum number of arguments this command line option should expectmaxArguments
- the maximum number of arguments this command line option will acceptjava.lang.IllegalArgumentException
- if minimum arguments is negativejava.lang.IllegalArgumentException
- if maximum arguments is less than minimum argumentsjava.lang.IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption addLongNames(java.util.Collection<java.lang.String> longNames)
longNames
- long names to be addedjava.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addLongNames(java.lang.String[] longNames)
longNames
- long names to be addedjava.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addLongName(java.lang.String name)
name
- long name to be addedjava.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(java.util.Collection<java.lang.Character> shortNames)
shortNames
- short names to be addedjava.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(char[] shortNames)
shortNames
- short names to be addedjava.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(java.lang.Character[] shortNames)
shortNames
- short names to be addedjava.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortName(java.lang.Character name)
name
- short name to be addedjava.lang.IllegalArgumentException
- if the name is null or blankpublic java.lang.String toString()
toString
in class java.lang.Object
public CmdLnOption setListener(CmdLnListener callback)
callback
- the call back objectpublic java.lang.Object getUserObject()
public CmdLnOption setUserObject(java.lang.Object userObject)
userObject
- the userObject to setpublic java.lang.String getDescription()
public CmdLnOption setDescription(java.lang.String description)
description
- the description used in the help messageCopyright (c) 2001-2020 by Stephen Ostermiller