de.caff.generics

## Class Enums

- java.lang.Object
- - de.caff.generics.Enums

-     public class Enums
      extends java.lang.Object

  Toolbox for enums.
  Author:
    Rammi

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getEnumFromOrdinal

          @Nullable
          public static <E> E getEnumFromOrdinal(@NotNull
                                                           E[] values,
                                                           int ordinal)

      Get an enum value from its ordinal.
      Type Parameters:
        `E` - type of returned value, usually an enum but this is not enforced
      Parameters:
        `values` - enum values with ordinal indices
        `ordinal` - enum ordinal
      Returns:
        associated value or `null` if there is no matching value

    - #### getEnumFromOrdinal

          @Nullable
          public static <E> E getEnumFromOrdinal(@NotNull
                                                           Indexable<E> values,
                                                           int ordinal)

      Get an enum value from its ordinal.
      Type Parameters:
        `E` - type of returned value, usually an enum but this is not enforced
      Parameters:
        `values` - enum values with ordinal indices
        `ordinal` - enum ordinal
      Returns:
        associated value or `null` if there is no matching value

    - #### getEnumFromOrdinal

          @NotNull
          public static <E> E getEnumFromOrdinal(@NotNull
                                                          E[] values,
                                                          int ordinal,
                                                          @NotNull
                                                          E defaultValue)

      Get an enum value from its ordinal.
      Type Parameters:
        `E` - type of returned value, usually an enum but this is not enforced
      Parameters:
        `values` - enum values with ordinal indices
        `ordinal` - enum ordinal
        `defaultValue` - default value returned if ordinal is out of range
      Returns:
        associated value or `defaultValue` if there is no matching value

    - #### getEnumFromOrdinal

          @NotNull
          public static <E> E getEnumFromOrdinal(@NotNull
                                                          Indexable<E> values,
                                                          int ordinal,
                                                          @NotNull
                                                          E defaultValue)

      Get an enum value from its ordinal.
      Type Parameters:
        `E` - type of returned value, usually an enum but this is not enforced
      Parameters:
        `values` - enum values with ordinal indices
        `ordinal` - enum ordinal
        `defaultValue` - default value returned if ordinal is out of range
      Returns:
        associated value or `defaultValue` if there is no matching value