Module net.sourceforge.argparse4j
Class CaseInsensitiveEnumNameArgumentType<T extends java.lang.Enum<T>>
- java.lang.Object
-
- net.sourceforge.argparse4j.impl.type.CaseInsensitiveEnumArgumentType<T>
-
- net.sourceforge.argparse4j.impl.type.CaseInsensitiveEnumNameArgumentType<T>
-
- Type Parameters:
T- Type of enum
- All Implemented Interfaces:
ArgumentType<T>,MetavarInference
public class CaseInsensitiveEnumNameArgumentType<T extends java.lang.Enum<T>> extends CaseInsensitiveEnumArgumentType<T>
ArgumentType subclass for enum type using case-insensitive matching of values.
Uses
Enum.name()as the String representation of the enum.- Since:
- 0.8.0
-
-
Field Summary
-
Fields inherited from class net.sourceforge.argparse4j.impl.type.CaseInsensitiveEnumArgumentType
type_
-
-
Constructor Summary
Constructors Constructor Description CaseInsensitiveEnumNameArgumentType(java.lang.Class<T> type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends java.lang.Enum<T>>
CaseInsensitiveEnumNameArgumentType<T>forEnum(java.lang.Class<T> type)Creates aCaseInsensitiveEnumNameArgumentTypefor the given enum type.protected java.lang.Object[]getStringRepresentations()Get the objects to be used to generate the String representations of all enum constants.protected java.lang.StringtoStringRepresentation(T t)Convert the given enum value to its string representation.-
Methods inherited from class net.sourceforge.argparse4j.impl.type.CaseInsensitiveEnumArgumentType
convert, inferMetavar
-
-
-
-
Constructor Detail
-
CaseInsensitiveEnumNameArgumentType
public CaseInsensitiveEnumNameArgumentType(java.lang.Class<T> type)
-
-
Method Detail
-
forEnum
public static <T extends java.lang.Enum<T>> CaseInsensitiveEnumNameArgumentType<T> forEnum(java.lang.Class<T> type)
Creates a
CaseInsensitiveEnumNameArgumentTypefor the given enum type.- Type Parameters:
T- The type of the enum- Parameters:
type- type of the enum theCaseInsensitiveEnumNameArgumentTypeshould convert to- Returns:
- a
CaseInsensitiveEnumNameArgumentTypethat converts Strings totype
-
toStringRepresentation
protected java.lang.String toStringRepresentation(T t)
Description copied from class:CaseInsensitiveEnumArgumentTypeConvert the given enum value to its string representation.
- Overrides:
toStringRepresentationin classCaseInsensitiveEnumArgumentType<T extends java.lang.Enum<T>>- Parameters:
t- the enum value to convert.- Returns:
- the string representation of
t.
-
getStringRepresentations
protected java.lang.Object[] getStringRepresentations()
Description copied from class:CaseInsensitiveEnumArgumentTypeGet the objects to be used to generate the String representations of all enum constants.
Object.toString()will be invoked on these objects to obtain the actual String representation.- Overrides:
getStringRepresentationsin classCaseInsensitiveEnumArgumentType<T extends java.lang.Enum<T>>- Returns:
- The objects used to generate String representations.
-
-