Enum Class NullBool
- All Implemented Interfaces:
Serializable,Comparable<NullBool>,Constable
Enum used to return a
Boolean Value with a fallback, should the boolean be null.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionbooleangetOrDefault(boolean def) Returns the NullBool's Boolean value or the provideddefvalue, should the Instance be equal to NullBool.NOT_SET.booleanisNotSet()Returns whether the NullBool Instance is NullBool.NOT_SET.static @NonNull NullBoolReturns a NullBool Instance based on the providedBooleaninstance:static NullBoolReturns the enum constant of this class with the specified name.static NullBool[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TRUE
Representation of the Boolean valuetrue. -
FALSE
Representation of the Boolean valuefalse. -
NOT_SET
Representation of anullBoolean value.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
resolve
Returns a NullBool Instance based on the provided
Booleaninstance:truewill return NullBool.TRUEfalsewill return NullBool.FALSEnullwill return NullBool.NOT_SET
- Parameters:
bool- Boolean to obtain a NullBool Instance from.- Returns:
- NullBool Instance based on the provided
Booleanvalue.
-
isNotSet
public boolean isNotSet()Returns whether the NullBool Instance is NullBool.NOT_SET.- Returns:
trueif the Instance is equal to NullBool.NOT_SET.
-
getOrDefault
public boolean getOrDefault(boolean def) Returns the NullBool's Boolean value or the provideddefvalue, should the Instance be equal to NullBool.NOT_SET.- Parameters:
def- Default boolean value to return, should the NullBool instance be equal to NullBool.NOT_SET.- Returns:
trueorfalsebased on the NullBool's Instance and the provideddefvalue.
-