T
- Type of enumpublic 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
.
type_
Constructor and Description |
---|
CaseInsensitiveEnumStringArgumentType(Class<T> type) |
Modifier and Type | Method and Description |
---|---|
static <T extends Enum<T>> |
forEnum(Class<T> type)
Creates a
CaseInsensitiveEnumStringArgumentType for the given
enum type. |
protected Object[] |
getStringRepresentations()
Get the objects to be used to generate the String representations of all
enum constants.
|
protected String |
toStringRepresentation(T t)
Convert the given enum value to its string representation.
|
convert, inferMetavar
public static <T extends Enum<T>> CaseInsensitiveEnumStringArgumentType<T> forEnum(Class<T> type)
Creates a CaseInsensitiveEnumStringArgumentType
for the given
enum type.
type
- type of the enum the CaseInsensitiveEnumStringArgumentType
should convert toCaseInsensitiveEnumStringArgumentType
that converts
Strings to type
protected String toStringRepresentation(T t)
CaseInsensitiveEnumArgumentType
Convert the given enum value to its string representation.
toStringRepresentation
in class CaseInsensitiveEnumArgumentType<T extends Enum<T>>
t
- the enum value to convert.t
.protected Object[] getStringRepresentations()
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.
getStringRepresentations
in class CaseInsensitiveEnumArgumentType<T extends Enum<T>>
Copyright © 2012–2017. All rights reserved.