Enum Class Priority

java.lang.Object
java.lang.Enum<Priority>
de.luckymcdev.foundryengine.common.priority.Priority
All Implemented Interfaces:
Serializable, Comparable<Priority>, Constable

public enum Priority extends Enum<Priority>
Generic Priority Enum for ordering and prioritization. Lower ordinal = higher priority (HIGHEST loads/executes first).
  • Enum Constant Details

    • HIGHEST

      public static final Priority HIGHEST
    • HIGH

      public static final Priority HIGH
    • NORMAL

      public static final Priority NORMAL
    • LOW

      public static final Priority LOW
    • LOWEST

      public static final Priority LOWEST
  • Method Details

    • values

      public static Priority[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Priority valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • comparator

      public static Comparator<Priority> comparator()
      Get a comparator that sorts by priority (highest first). Usage: list.sort(Priority.comparator())
      Returns:
      comparator for sorting by priority
    • comparing

      public static <T> Comparator<T> comparing(Function<? super T, Priority> keyExtractor)
      Get a comparator that sorts objects by their priority (highest first). Usage: entrypoints.sort(Priority.comparing(BundleEntrypoint::getPriority))
      Parameters:
      keyExtractor - function to extract priority from object
      Returns:
      comparator for sorting objects by priority
    • comparingReversed

      public static Comparator<Object> comparingReversed(Function<Object,Priority> keyExtractor)
      Get a comparator that sorts objects by priority in reverse (lowest first).
      Parameters:
      keyExtractor - function to extract priority from object
      Returns:
      reverse comparator for sorting objects by priority
    • highest

      public static Priority highest()
      Get the priority with the highest precedence (HIGHEST).
      Returns:
      HIGHEST priority
    • lowest

      public static Priority lowest()
      Get the priority with the lowest precedence (LOWEST).
      Returns:
      LOWEST priority
    • normal

      public static Priority normal()
      Get the default priority (NORMAL).
      Returns:
      NORMAL priority
    • parse

      public static Priority parse(String name)
      Parse priority from string (case-insensitive).
      Parameters:
      name - priority name
      Returns:
      parsed Priority, or NORMAL if invalid
    • parse

      public static Priority parse(String name, Priority fallback)
      Parse priority from string with fallback.
      Parameters:
      name - priority name
      fallback - fallback priority if parsing fails
      Returns:
      parsed Priority, or fallback if invalid
    • getValue

      public int getValue()
      Get the numeric value of this priority. Lower values = higher priority.
      Returns:
      numeric priority value
    • isHigherThan

      public boolean isHigherThan(Priority other)
      Check if this priority is higher than another.
      Parameters:
      other - priority to compare against
      Returns:
      true if this priority is higher (executes first)
    • isLowerThan

      public boolean isLowerThan(Priority other)
      Check if this priority is lower than another.
      Parameters:
      other - priority to compare against
      Returns:
      true if this priority is lower (executes last)
    • isSameAs

      public boolean isSameAs(Priority other)
      Check if this priority is the same as another.
      Parameters:
      other - priority to compare against
      Returns:
      true if priorities are equal
    • isAtLeast

      public boolean isAtLeast(Priority other)
      Check if this priority is at least as high as another.
      Parameters:
      other - priority to compare against
      Returns:
      true if this >= other
    • isAtMost

      public boolean isAtMost(Priority other)
      Check if this priority is at most as high as another.
      Parameters:
      other - priority to compare against
      Returns:
      true if this is greater than 'other' priority
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Priority>