|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.Ostermiller.util.CmdLnOption
public final class CmdLnOption
A command line option used by the CommandLineOptions parser. More information about this class and code samples for suggested use are available from ostermiller.org.
Constructor Summary | |
---|---|
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)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CmdLnOption(java.lang.String[] longNames)
longNames
- list long names for this option
java.lang.IllegalArgumentException
- if the the list does not contain at least one long namepublic CmdLnOption(char[] shortNames)
shortNames
- list short names for this option
java.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 option
java.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 option
java.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 optionMethod Detail |
---|
public 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 accept
java.lang.IllegalArgumentException
- if minimum arguments is negative
java.lang.IllegalArgumentException
- if maximum arguments is less than minimum arguments
java.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 added
java.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addLongNames(java.lang.String[] longNames)
longNames
- long names to be added
java.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addLongName(java.lang.String name)
name
- long name to be added
java.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(java.util.Collection<java.lang.Character> shortNames)
shortNames
- short names to be added
java.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(char[] shortNames)
shortNames
- short names to be added
java.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(java.lang.Character[] shortNames)
shortNames
- short names to be added
java.lang.IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortName(java.lang.Character name)
name
- short name to be added
java.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 object
public java.lang.Object getUserObject()
public CmdLnOption setUserObject(java.lang.Object userObject)
userObject
- the userObject to set
public java.lang.String getDescription()
public CmdLnOption setDescription(java.lang.String description)
description
- the description used in the help message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |