public class OptionList extends Object
| Constructor and Description |
|---|
OptionList()
Creates a new OptionList with an empty list of options
|
OptionList(Collection<Option<?>> options)
Creates a new OptionList initialised with all non-null options from the collection
|
OptionList(Option<?> option)
Creates a new OptionList with given input option (if not null)
|
OptionList(Option<?>[] options)
Creates a new OptionList initialised with all non-null options from the array
|
| Modifier and Type | Method and Description |
|---|---|
OptionList |
addOption(Collection<Option<?>> options)
Adds options from a collection to the list (all non-null options)
|
OptionList |
addOption(Option<?> option)
Adds an option to the list
|
OptionList |
addOption(Option<?>[] options)
Adds options from an array to the list (all non-null options)
|
Option<?> |
getOption(String option)
Returns the option that uses the given string as option, null otherwise
|
Boolean |
getOptValue(String option,
Boolean def)
Returns the boolean value of the requested option or the default value
|
char[] |
getOptValue(String option,
char[] def)
Returns the character array value of the requested option or the default value
|
Character |
getOptValue(String option,
Character def)
Returns the character value of the requested option or the default value
|
Double |
getOptValue(String option,
Double def)
Returns the double value of the requested option or the default value
|
Integer |
getOptValue(String option,
Integer def)
Returns the integer value of the requested option or the default value
|
String |
getOptValue(String option,
String def)
Returns the string value of the requested option or the default value
|
boolean |
hasOption(Option<?> option)
Returns true if the list contains the option
|
boolean |
hasOption(String option)
Returns true if the list contains an option whos getOption returns the given string
|
String |
toString() |
public OptionList()
public OptionList(Option<?> option)
option - initial optionpublic OptionList(Collection<Option<?>> options)
options - collection of optionspublic OptionList(Option<?>[] options)
options - array of optionspublic OptionList addOption(Option<?> option)
option - option to be addedpublic OptionList addOption(Option<?>[] options)
options - array of options to be addedpublic OptionList addOption(Collection<Option<?>> options)
options - collection of options to be addedpublic boolean hasOption(Option<?> option)
option - option to test forpublic boolean hasOption(String option)
option - string to testpublic Option<?> getOption(String option)
option - option to test forpublic Character getOptValue(String option, Character def)
option - option to search fordef - default value to returnpublic char[] getOptValue(String option, char[] def)
option - option to search fordef - default value to returnpublic String getOptValue(String option, String def)
option - option to search fordef - default value to returnpublic Boolean getOptValue(String option, Boolean def)
option - option to search fordef - default value to returnpublic Integer getOptValue(String option, Integer def)
option - option to search fordef - default value to returnpublic Double getOptValue(String option, Double def)
option - option to search fordef - default value to returnCopyright © 2010–2015. All rights reserved.