Package net.fabricmc.fabric.api.util
Enum Class TriState
- All Implemented Interfaces:
- Serializable,- Comparable<TriState>,- Constable
Represents a boolean value which can be true, false or refer to a default value.
- 
Nested Class SummaryNested classes/interfaces inherited from class java.lang.EnumEnum.EnumDesc<E extends Enum<E>>
- 
Enum Constant SummaryEnum Constants
- 
Method SummaryModifier and TypeMethodDescriptionbooleanget()Gets the value of the tri-state.@Nullable BooleangetBoxed()Gets the value of the tri-state as a boxed, nullable boolean.<T> Optional<T> map(BooleanFunction<@Nullable ? extends T> mapper) static TriStateof(boolean bool) Gets the corresponding tri-state from a boolean value.static TriStateGets a tri-state from a nullable boxed boolean.booleanorElse(boolean value) Gets the value of this tri-state.booleanorElseGet(BooleanSupplier supplier) Gets the value of this tri-state.<X extends Throwable>
 booleanorElseThrow(Supplier<X> exceptionSupplier) Gets the value of this tri-state, or throws an exception if this tri-state's value isDEFAULT.static TriStateReturns the enum constant of this class with the specified name.static TriState[]values()Returns an array containing the constants of this enum class, in the order they are declared.
- 
Enum Constant Details- 
FALSERepresents the boolean value offalse.
- 
DEFAULTRepresents a value that refers to a "default" value, often as a fallback.
- 
TRUERepresents the boolean value oftrue.
 
- 
- 
Method Details- 
valuesReturns 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
 
- 
valueOfReturns 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
 
- 
ofGets the corresponding tri-state from a boolean value.
- 
ofGets a tri-state from a nullable boxed boolean.
- 
getpublic boolean get()Gets the value of the tri-state.- Returns:
- true if the tri-state is TRUE, otherwise false.
 
- 
getBoxedGets the value of the tri-state as a boxed, nullable boolean.
- 
orElsepublic boolean orElse(boolean value) Gets the value of this tri-state. If the value isDEFAULTthen use the supplied value.- Parameters:
- value- the value to fall back to
- Returns:
- the value of the tri-state or the supplied value if DEFAULT.
 
- 
orElseGetGets the value of this tri-state. If the value isDEFAULTthen use the supplied value.- Parameters:
- supplier- the supplier used to get the value to fall back to
- Returns:
- the value of the tri-state or the value of the supplier if the tri-state is DEFAULT.
 
- 
map- Type Parameters:
- T- the type of object being supplier by the mapper
- Parameters:
- mapper- the mapper to use
- Returns:
- an optional containing the mapped value; Optional.empty()if the tri-state isDEFAULTor the value provided by the mapper isnull.
 
- 
orElseThrowGets the value of this tri-state, or throws an exception if this tri-state's value isDEFAULT.- Type Parameters:
- X- Type of the exception to be thrown
- Parameters:
- exceptionSupplier- the supplying function that produces an exception to be thrown
- Returns:
- the value
- Throws:
- X- if the value is- DEFAULT
 
 
-