Class EnumUtils

java.lang.Object
org.deltava.util.EnumUtils

public class EnumUtils extends Object
A utility class for enumeration operations.
Since:
9.0
Version:
11.5
Author:
Luke
  • Method Details

    • parse

      public static <E extends Enum<E>> E parse(Class<E> c, String value, E defaultValue)
      Exception-safe enumeration parser.
      Type Parameters:
      E - the Enumeration
      Parameters:
      c - the Enumeration Class
      value - the value to parse
      defaultValue - the default value if invalid or an error occurs
      Returns:
      an Enumeration value
    • max

      public static <E extends Enum<E>> E max(E e1, E e2)
      Returns the higher of two enumerations.
      Parameters:
      e1 - the first enum
      e2 - the second enum
      Returns:
      the larger enum based on ordinal