public class Enums
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <E> E |
getEnumFromOrdinal(E[] values,
int ordinal)
Get an enum value from its ordinal.
|
static <E> E |
getEnumFromOrdinal(E[] values,
int ordinal,
E defaultValue)
Get an enum value from its ordinal.
|
static <E> E |
getEnumFromOrdinal(Indexable<E> values,
int ordinal)
Get an enum value from its ordinal.
|
static <E> E |
getEnumFromOrdinal(Indexable<E> values,
int ordinal,
E defaultValue)
Get an enum value from its ordinal.
|
@Nullable public static <E> E getEnumFromOrdinal(@NotNull E[] values, int ordinal)
E
- type of returned value, usually an enum but this is not enforcedvalues
- enum values with ordinal indicesordinal
- enum ordinalnull
if there is no matching value@Nullable public static <E> E getEnumFromOrdinal(@NotNull Indexable<E> values, int ordinal)
E
- type of returned value, usually an enum but this is not enforcedvalues
- enum values with ordinal indicesordinal
- enum ordinalnull
if there is no matching value@NotNull public static <E> E getEnumFromOrdinal(@NotNull E[] values, int ordinal, @NotNull E defaultValue)
E
- type of returned value, usually an enum but this is not enforcedvalues
- enum values with ordinal indicesordinal
- enum ordinaldefaultValue
- default value returned if ordinal is out of rangedefaultValue
if there is no matching value@NotNull public static <E> E getEnumFromOrdinal(@NotNull Indexable<E> values, int ordinal, @NotNull E defaultValue)
E
- type of returned value, usually an enum but this is not enforcedvalues
- enum values with ordinal indicesordinal
- enum ordinaldefaultValue
- default value returned if ordinal is out of rangedefaultValue
if there is no matching value