Enum Class TriState

java.lang.Object
java.lang.Enum<TriState>
org.geysermc.geyser.api.util.TriState
All Implemented Interfaces:
Serializable, Comparable<TriState>, Constable

public enum TriState extends Enum<TriState>
This is a way to represent a boolean, but with a non set value added. This class was inspired by adventure's TriState
  • Enum Constant Details

    • NOT_SET

      public static final TriState NOT_SET
      Describes a value that is not set, null, or not present.
    • TRUE

      public static final TriState TRUE
      Describes a true value.
    • FALSE

      public static final TriState FALSE
      Describes a false value.
  • Method Details

    • values

      public static TriState[] 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 TriState 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
    • toBoolean

      public @Nullable Boolean toBoolean()
      Converts the TriState to a boolean.
      Returns:
      the boolean value of the TriState
    • fromBoolean

      public static @NonNull TriState fromBoolean(@Nullable Boolean value)
      Creates a TriState from a boolean.
      Parameters:
      value - the Boolean value
      Returns:
      the created TriState
    • fromBoolean

      public static @NonNull TriState fromBoolean(boolean value)
      Creates a TriState from a primitive boolean.
      Parameters:
      value - the boolean value
      Returns:
      the created TriState