Enum Class Tristate

java.lang.Object
java.lang.Enum<Tristate>
org.spongepowered.api.util.Tristate
All Implemented Interfaces:
Serializable, Comparable<Tristate>, Constable

public enum Tristate extends Enum<Tristate>
Represents a simple tristate.
  • Enum Constant Details Link icon

    • TRUE Link icon

      public static final Tristate TRUE
    • FALSE Link icon

      public static final Tristate FALSE
    • UNDEFINED Link icon

      public static final Tristate UNDEFINED
  • Method Details Link icon

    • values Link icon

      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 Link icon

      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
    • fromBoolean Link icon

      public static Tristate fromBoolean(boolean val)
      Returns the appropriate tristate for a given boolean value.
      Parameters:
      val - The boolean value
      Returns:
      The appropriate tristate
    • fromNullableBoolean Link icon

      public static Tristate fromNullableBoolean(@Nullable Boolean val)
      Returns the appropriate tristate for a given nullable boolean value, where null equates to UNDEFINED.
      Parameters:
      val - The nullable boolean value
      Returns:
      The appropriate tristate
    • and Link icon

      public abstract Tristate and(Tristate other)
      ANDs this tristate with another tristate.
      Parameters:
      other - The tristate to AND with
      Returns:
      The result
    • or Link icon

      public abstract Tristate or(Tristate other)
      ORs this tristate with another tristate.
      Parameters:
      other - The tristate to OR with
      Returns:
      The result
    • not Link icon

      public abstract Tristate not()
      Negates this tristate.
      Returns:
      The result
    • asBoolean Link icon

      public boolean asBoolean()
      Returns the boolean representation of this tristate.
      Returns:
      The boolean tristate representation
    • asNullableBoolean Link icon

      public @Nullable Boolean asNullableBoolean()
      Returns the nullable boolean representation of this tristate, where UNDEFINED equates to null.

      Note: To ensure that there is a one-to-one mapping of nullable booleans to and from Tristate, this method will return null rather than use an Optional.

      Returns:
      The nullable boolean tristate representation