Class EnumStringParser<E extends Enum<E>>

java.lang.Object
com.martiansoftware.jsap.StringParser
it.unimi.dsi.lang.EnumStringParser<E>

public class EnumStringParser<E extends Enum<E>> extends StringParser
A StringParser that makes the user choose among items of a Java enum.

Optionally, parsed strings can be normalized to upper case. Thus, if the enum elements are defined in uppercase, the parser will be in practice case-independent.

A typical usage example for an ExampleEnum with an item A that is going to be the default:

 new FlaggedOption("example",
     EnumStringParser.getParser(ExampleEnum.class, true),
     ExampleEnum.A.name(), JSAP.NOT_REQUIRED, 'e', "example",
     Arrays.toString(ExampleEnum.values()))