|
com.Ostermiller.util Java Utilities |
|||||||
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(Character shortName)
|
|
CmdLnOption(String longName)
|
|
CmdLnOption(String[] longNames)
|
|
CmdLnOption(String[] longNames,
char[] shortNames)
|
|
CmdLnOption(String longName,
Character shortName)
|
Method Summary | |
---|---|
CmdLnOption |
addLongName(String name)
|
CmdLnOption |
addLongNames(Collection<String> longNames)
|
CmdLnOption |
addLongNames(String[] longNames)
|
CmdLnOption |
addShortName(Character name)
|
CmdLnOption |
addShortNames(char[] shortNames)
|
CmdLnOption |
addShortNames(Character[] shortNames)
|
CmdLnOption |
addShortNames(Collection<Character> shortNames)
|
String |
getDescription()
|
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(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(Object userObject)
An object that may be set by the user. |
String |
toString()
Get a short string description this option. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CmdLnOption(String[] longNames)
longNames
- list long names for this option
IllegalArgumentException
- if the the list does not contain at least one long namepublic CmdLnOption(char[] shortNames)
shortNames
- list short names for this option
IllegalArgumentException
- if the the list does not contain at least one short namepublic CmdLnOption(String longName)
longName
- the long name for this option
IllegalArgumentException
- if the name is nullpublic CmdLnOption(Character shortName)
shortName
- the short name for this optionpublic CmdLnOption(String[] longNames, char[] shortNames)
longNames
- list long names for this optionshortNames
- list short names for this option
IllegalArgumentException
- if the the lists do not contain at least one namepublic CmdLnOption(String longName, Character shortName)
longName
- the long name for this optionshortName
- the short name for this optionMethod Detail |
---|
public CmdLnOption setNoArguments()
IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption setOptionalArgument()
IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption setRequiredArgument()
IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption setUnlimitedArguments()
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
IllegalArgumentException
- if minimum arguments is negative
IllegalArgumentException
- if maximum arguments is less than minimum arguments
IllegalStateException
- if this argument has already been used in parsing CommandLineOptionspublic CmdLnOption addLongNames(Collection<String> longNames)
longNames
- long names to be added
IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addLongNames(String[] longNames)
longNames
- long names to be added
IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addLongName(String name)
name
- long name to be added
IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(Collection<Character> shortNames)
shortNames
- short names to be added
IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(char[] shortNames)
shortNames
- short names to be added
IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortNames(Character[] shortNames)
shortNames
- short names to be added
IllegalArgumentException
- if the name is null or blankpublic CmdLnOption addShortName(Character name)
name
- short name to be added
IllegalArgumentException
- if the name is null or blankpublic String toString()
toString
in class Object
public CmdLnOption setListener(CmdLnListener callback)
callback
- the call back object
public Object getUserObject()
public CmdLnOption setUserObject(Object userObject)
userObject
- the userObject to set
public String getDescription()
public CmdLnOption setDescription(String description)
description
- the description used in the help message
|
com.Ostermiller.util Java Utilities |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2001-2012 by Stephen Ostermiller