public final class EnglishEnums
extends java.lang.Object
Helps convert English Strings to English Enum values.
Enum name arguments are converted internally to upper case with the ENGLISH locale to avoid problems on the Turkish locale. Do not use with Turkish enum values.
Modifier | Constructor and Description |
---|---|
private |
EnglishEnums() |
Modifier and Type | Method and Description |
---|---|
static <T extends java.lang.Enum<T>> |
valueOf(java.lang.Class<T> enumType,
java.lang.String name)
Returns the Result for the given string.
|
static <T extends java.lang.Enum<T>> |
valueOf(java.lang.Class<T> enumType,
java.lang.String name,
T defaultValue)
Returns an enum value for the given string.
|
public static <T extends java.lang.Enum<T>> T valueOf(java.lang.Class<T> enumType, java.lang.String name)
The name
is converted internally to upper case with the ENGLISH locale to
avoid problems on the Turkish locale. Do not use with Turkish enum values.
T
- The type of the enum.enumType
- The Class of the enum.name
- The enum name, case-insensitive. If null, returns defaultValue
.name
is null.public static <T extends java.lang.Enum<T>> T valueOf(java.lang.Class<T> enumType, java.lang.String name, T defaultValue)
The name
is converted internally to upper case with the ENGLISH locale to
avoid problems on the Turkish locale. Do not use with Turkish enum values.
T
- The type of the enum.name
- The enum name, case-insensitive. If null, returns defaultValue
.enumType
- The Class of the enum.defaultValue
- the enum value to return if name
is null.defaultValue
if name
is null.