Module net.sourceforge.argparse4j
Class CaseInsensitiveEnumStringArgumentType<T extends Enum<T>>
java.lang.Object
net.sourceforge.argparse4j.impl.type.CaseInsensitiveEnumArgumentType<T>
net.sourceforge.argparse4j.impl.type.CaseInsensitiveEnumStringArgumentType<T>
- Type Parameters:
T
- Type of enum
- All Implemented Interfaces:
ArgumentType<T>
,MetavarInference
public class CaseInsensitiveEnumStringArgumentType<T extends Enum<T>>
extends CaseInsensitiveEnumArgumentType<T>
ArgumentType subclass for enum type using case-insensitive matching of values.
Uses Enum.toString()
instead of Enum.name()
as the String
representation of the enum. For enums that do not override
Enum.toString()
, this behaves the same as
CaseInsensitiveEnumNameArgumentType
.
- Since:
- 0.8.0
-
Field Summary
Fields inherited from class net.sourceforge.argparse4j.impl.type.CaseInsensitiveEnumArgumentType
type_
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T>>
CaseInsensitiveEnumStringArgumentType<T> Creates aCaseInsensitiveEnumStringArgumentType
for the given enum type.protected Object[]
Get the objects to be used to generate the String representations of all enum constants.protected String
Convert the given enum value to its string representation.Methods inherited from class net.sourceforge.argparse4j.impl.type.CaseInsensitiveEnumArgumentType
convert, inferMetavar
-
Constructor Details
-
CaseInsensitiveEnumStringArgumentType
-
-
Method Details
-
forEnum
Creates a
CaseInsensitiveEnumStringArgumentType
for the given enum type.- Type Parameters:
T
- The type of the enum- Parameters:
type
- type of the enum theCaseInsensitiveEnumStringArgumentType
should convert to- Returns:
- a
CaseInsensitiveEnumStringArgumentType
that converts Strings totype
-
toStringRepresentation
Description copied from class:CaseInsensitiveEnumArgumentType
Convert the given enum value to its string representation.
- Overrides:
toStringRepresentation
in classCaseInsensitiveEnumArgumentType<T extends Enum<T>>
- Parameters:
t
- the enum value to convert.- Returns:
- the string representation of
t
.
-
getStringRepresentations
Description copied from class:CaseInsensitiveEnumArgumentType
Get 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:
getStringRepresentations
in classCaseInsensitiveEnumArgumentType<T extends Enum<T>>
- Returns:
- The objects used to generate String representations.
-