Class EnumUtil

java.lang.Object
com.earth2me.essentials.utils.EnumUtil

public final class EnumUtil extends Object
  • Method Details

    • valueOf

      public static <T extends Enum<T>> T valueOf(Class<T> enumClass, String... names)
      Returns the field matching the first provided enum name that exists within the given enum class. If no field is found, this method returns null.
      Type Parameters:
      T - The enum to search through
      Parameters:
      enumClass - The class to search through
      names - The names of the fields to search for
      Returns:
      The first matching enum field
    • getAllMatching

      public static <T extends Enum<T>> Set<T> getAllMatching(Class<T> enumClass, String... names)
      Return a set containing all fields of the given enum that match one of the provided names.
      Type Parameters:
      T - The enum to search through
      Parameters:
      enumClass - The class to search through
      names - The names of the fields to search for
      Returns:
      All matching enum fields
    • getMaterial

      public static Material getMaterial(String... names)
      Gets the first Material field found from the given names.
      Parameters:
      names - The names of the fields to search for
      Returns:
      The first matching Material
    • getStatistic

      public static Statistic getStatistic(String... names)
      Gets the first Statistic field found from the given names.
      Parameters:
      names - The names of the fields to search for
      Returns:
      The first matching Statistic
    • getEntityType

      public static EntityType getEntityType(String... names)