public abstract class EnumConverter<T extends Enum<T>> extends 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(Class<T> enumType,
String typeName)
Creates a new enum converter.
|
| Modifier and Type | Method and Description |
|---|---|
T |
convert(String input)
Implements
convert(String). |
String |
getTypeDescription()
Implements
getTypeDescription(). |
protected EnumConverter(Class<T> enumType, 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(String input) throws OptionsParsingException
convert(String).public final String getTypeDescription()
getTypeDescription().getTypeDescription in interface Converter<T extends Enum<T>>Copyright © 2016. All rights reserved.