Package ubic.gemma.cli.util
Class EnumConverter<T extends Enum<T>>
java.lang.Object
ubic.gemma.cli.util.EnumConverter<T>
- All Implemented Interfaces:
org.apache.commons.cli.Converter<T,
,IllegalArgumentException> EnumeratedConverter<T,
IllegalArgumentException>
public class EnumConverter<T extends Enum<T>>
extends Object
implements EnumeratedConverter<T,IllegalArgumentException>
Convert
Enum
to string.
This converter accepts both snake-case and kebab-case strings. It will first attempt to match the string as-is, then it will perform an upper case match.
- Author:
- poirigui
-
Field Summary
Fields inherited from interface org.apache.commons.cli.Converter
CLASS, DATE, DEFAULT, FILE, NUMBER, OBJECT, PATH, URL
-
Method Summary
Modifier and TypeMethodDescriptionObtain a list of possible values that the converter can convert toEnumeratedConverter
.static <T extends Enum<T>>
EnumConverter<T> static <T extends Enum<T>>
EnumConverter<T>
-
Method Details
-
of
-
of
public static <T extends Enum<T>> EnumConverter<T> of(Class<T> enumClass, EnumMap<T, org.springframework.context.MessageSourceResolvable> descriptions) -
apply
- Specified by:
apply
in interfaceorg.apache.commons.cli.Converter<T extends Enum<T>,
IllegalArgumentException>
-
getPossibleValues
Description copied from interface:EnumeratedConverter
Obtain a list of possible values that the converter can convert toEnumeratedConverter
.Implementation should use either a
SortedMap
orLinkedHashMap
for reproducibility.- Specified by:
getPossibleValues
in interfaceEnumeratedConverter<T extends Enum<T>,
IllegalArgumentException>
-