Enum DataQueryOrder
- java.lang.Object
-
- java.lang.Enum<DataQueryOrder>
-
- net.luckperms.api.query.dataorder.DataQueryOrder
-
- All Implemented Interfaces:
Serializable,Comparable<DataQueryOrder>,Comparator<DataType>
public enum DataQueryOrder extends Enum<DataQueryOrder> implements Comparator<DataType>
Represents the order in which to query differentDataTypes.The
DataQueryOrderenum simply represents some default implementations of theComparatorrequired byQueryOptionsand thequeryInOrder(Comparator, Consumer)ororder(Comparator)methods.Users are free to implement their own comparator. However, be aware that it is possible that more
DataTypes may be added in the future. Ideally theComparatorimplementations should be able to handle these smoothly.- See Also:
DataQueryOrderFunction
-
-
Enum Constant Summary
Enum Constants Enum Constant Description TRANSIENT_FIRSTA data query order indicating thatDataType.TRANSIENTshould be queried first.TRANSIENT_LASTA data query order indicating thatDataType.TRANSIENTshould be queried last.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<DataType>order(@NonNull Comparator<? super DataType> comparator)static voidqueryInOrder(@NonNull Comparator<? super DataType> comparator, @NonNull Consumer<? super DataType> action)static DataQueryOrdervalueOf(String name)Returns the enum constant of this type with the specified name.static DataQueryOrder[]values()Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface java.util.Comparator
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Enum Constant Detail
-
TRANSIENT_FIRST
public static final DataQueryOrder TRANSIENT_FIRST
A data query order indicating thatDataType.TRANSIENTshould be queried first.
-
TRANSIENT_LAST
public static final DataQueryOrder TRANSIENT_LAST
A data query order indicating thatDataType.TRANSIENTshould be queried last.
-
-
Method Detail
-
values
public static DataQueryOrder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DataQueryOrder c : DataQueryOrder.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DataQueryOrder valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
order
public static List<DataType> order(@NonNull Comparator<? super DataType> comparator)
Gets aListof allDataTypes, in order of greatest to least, as defined by thecomparator.Equivalent to calling
Arrays.sort(Object[], Comparator)onDataType.values(), but with the comparatorreversed.- Parameters:
comparator- the comparator- Returns:
- the ordered data types
-
-