public class Enums
extends java.lang.Object
Constructor and Description |
---|
Enums() |
Modifier and Type | Method and Description |
---|---|
static void |
checkAllEnumeratedIgnoreCase(java.lang.Class<? extends java.lang.Enum<?>> type,
java.lang.String... explicitValues)
as
checkAllEnumeratedIgnoreCase(String, Enum[], String...) using the same default strategy
that valueOfIgnoreCase(Class, String) applies |
static void |
checkAllEnumeratedIgnoreCase(java.lang.String contextMessage,
java.lang.Enum<?>[] enumValues,
java.lang.String... explicitValues)
checks that all accepted enum values are represented by the given set of explicit values
|
static <T extends java.lang.Enum<?>> |
fromStringFunction(java.lang.Class<T> type)
returns a function which given a string, produces an enum of the given type or null
|
static <any> |
nameFunction()
returns a function which given an enum, returns its
name() function |
static <T extends java.lang.Enum<?>> |
valueOfIgnoreCase(java.lang.Class<T> type,
java.lang.String givenValue)
as
valueOfIgnoreCase(String, Enum[], String) for all values of the given enum and using the enum type as the message |
static <T extends java.lang.Enum<?>> |
valueOfIgnoreCase(java.lang.String contextMessage,
T[] enumValues,
java.lang.String givenValue)
attempts to match the givenValue against the given enum values, first looking for exact matches (against name and toString),
then matching ignoring case,
then matching with
CaseFormat#UPPER_UNDERSCORE converted to CaseFormat#LOWER_CAMEL ,
then matching with CaseFormat#LOWER_CAMEL converted to CaseFormat#UPPER_UNDERSCORE
(including case insensitive matches for the final two) |
static <T extends java.lang.Enum<?>> |
values(java.lang.Class<T> type)
returns array of values in the given enum, or null if it is not an enum
|
public static <any> nameFunction()
name()
functionpublic static <T extends java.lang.Enum<?>> <any> fromStringFunction(java.lang.Class<T> type)
public static <T extends java.lang.Enum<?>> T[] values(java.lang.Class<T> type)
public static void checkAllEnumeratedIgnoreCase(java.lang.Class<? extends java.lang.Enum<?>> type, java.lang.String... explicitValues)
checkAllEnumeratedIgnoreCase(String, Enum[], String...)
using the same default strategy
that valueOfIgnoreCase(Class, String)
appliespublic static void checkAllEnumeratedIgnoreCase(java.lang.String contextMessage, java.lang.Enum<?>[] enumValues, java.lang.String... explicitValues)
public static <T extends java.lang.Enum<?>> Maybe<T> valueOfIgnoreCase(java.lang.Class<T> type, java.lang.String givenValue)
valueOfIgnoreCase(String, Enum[], String)
for all values of the given enum and using the enum type as the messagepublic static <T extends java.lang.Enum<?>> Maybe<T> valueOfIgnoreCase(java.lang.String contextMessage, T[] enumValues, java.lang.String givenValue)
CaseFormat#UPPER_UNDERSCORE
converted to CaseFormat#LOWER_CAMEL
,
then matching with CaseFormat#LOWER_CAMEL
converted to CaseFormat#UPPER_UNDERSCORE
(including case insensitive matches for the final two)