E - the return type of the optionpublic abstract class EnumeratedOption<E> extends Option<E>
Option with value restricted to an
enumeration of a specified return value type.| Modifier and Type | Field and Description |
|---|---|
protected Collection<E> |
allowedValues
Collection of allowed values for this enumeration.
|
bundle, ILLEGAL_SN_CHARS, locale, MAX_COUNT_LIMIT, MIN_COUNT_LIMIT, values| Constructor and Description |
|---|
EnumeratedOption(String shortName,
String longName,
String description,
boolean mandatory,
boolean allowMany,
Collection<E> allowedValues)
Creates a new
EnumeratedOption instance. |
EnumeratedOption(String shortName,
String longName,
String description,
int minCount,
int maxCount,
Collection<E> allowedValues)
Creates a new
EnumeratedOption instance. |
| Modifier and Type | Method and Description |
|---|---|
Collection<E> |
getAllowedValues()
Returns an unmodifiable collection of the values that can be
assigned to this option.
|
String |
getAllowedValuesString() |
String |
getAllowedValuesString(String fix,
String separator)
Returns a string denoting the values that can be assigned to this option.
|
String |
getAllowedValuesString(String prefix,
String suffix,
String separator)
Returns a string denoting the values that can be assigned to this option.
|
boolean |
isValueValid(E value) |
String |
toString() |
addValue, equals, getDescription, getLongName, getMaxCount, getMinCount, getShortName, getType, getUsageTypeString, getValues, hashCode, isAllowMany, isHidden, isMandatory, parseValue, requiresValue, setHidden, setMinMaxCountsprotected Collection<E> allowedValues
public EnumeratedOption(String shortName, String longName, String description, int minCount, int maxCount, Collection<E> allowedValues)
EnumeratedOption instance.shortName - short name of the option (e.g. -t)longName - long name of the option (e.g. --type)description - helpful description of the option (printed for usage message)minCount - minimum number of occurrences required for this optionmaxCount - maximum number of occurrences required for this optionallowedValues - collection of possible values this option can takepublic EnumeratedOption(String shortName, String longName, String description, boolean mandatory, boolean allowMany, Collection<E> allowedValues)
EnumeratedOption instance.shortName - short name of the option (e.g. -t)longName - long name of the option (e.g. --type)description - helpful description of the option (printed for usage message)mandatory - whether this option must be specifiedallowMany - whether this option can take more than one value (i.e. be specified more than once)allowedValues - collection of possible values this option can takepublic boolean isValueValid(E value)
value - value to check for validitypublic Collection<E> getAllowedValues()
public String getAllowedValuesString(String prefix, String suffix, String separator)
prefix - prefix string for each allowed valuesuffix - suffix string for each allowed valueseparator - string to use for delimiting individual valuespublic String getAllowedValuesString(String fix, String separator)
fix - prefix/suffix string for each allowed value (e.g. ")separator - string to use for delimiting individual valuespublic String getAllowedValuesString()
Copyright © 2015. All rights reserved.