Module MaterialFX

Class EnumUtils

java.lang.Object
io.github.palexdev.materialfx.utils.EnumUtils

public class EnumUtils extends Object
Utility class which provides convenience methods for enumerators
  • Method Details

    • valueOfIgnoreCase

      public static <E extends Enum<E>> E valueOfIgnoreCase(Class<E> clazz, String name)
      Checks if the given enumerator (as a class) contains the given String, same as Enum.valueOf(Class, String) but case-insensitive.
      Parameters:
      clazz - the Class object of the enum class from which to return a constant
      name - the name of the constant to return
      Returns:
      the enum constant of the specified enum class with the specified name
    • randomEnum

      public static <E extends Enum<E>> E randomEnum(Class<E> clazz)
      Given an enumerator (as a class) retrieves a random constant using Class.getEnumConstants().