public abstract class EnumConverter<T extends java.lang.Enum<T>> extends java.lang.Object implements Converter<T>
Just subclass this class, creating a zero aro argument constructor that
calls EnumConverter(Class, String).
This class compares the input string to the string returned by the toString() method of each enum member in a case-insensitive way. Usually, this is the name of the symbol, but beware if you override toString()!
| Modifier | Constructor and Description |
|---|---|
protected |
EnumConverter(java.lang.Class<T> enumType,
java.lang.String typeName)
Creates a new enum converter.
|
| Modifier and Type | Method and Description |
|---|---|
T |
convert(java.lang.String input)
Implements
convert(String). |
java.lang.String |
getTypeDescription()
Implements
getTypeDescription(). |
protected EnumConverter(java.lang.Class<T> enumType, java.lang.String typeName)
enumType - The type of your enumeration; usually a class literal
like MyEnum.classtypeName - The intuitive name of your enumeration, for example, the
type name for CompilationMode might be "compilation mode".public T convert(java.lang.String input) throws OptionsParsingException
convert(String).convert in interface Converter<T extends java.lang.Enum<T>>OptionsParsingExceptionpublic final java.lang.String getTypeDescription()
getTypeDescription().getTypeDescription in interface Converter<T extends java.lang.Enum<T>>