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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getOrDefault
(boolean def) Returns the NullBool's Boolean value or the provideddef
value, should the Instance be equal to NullBool.NOT_SET.boolean
isNotSet()
Returns whether the NullBool Instance is NullBool.NOT_SET.static NullBool
Returns a NullBool Instance based on the providedBoolean
instance:static NullBool
Returns 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 anull
Boolean 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
Boolean
instance:true
will return NullBool.TRUEfalse
will return NullBool.FALSEnull
will return NullBool.NOT_SET
- Parameters:
bool
- Boolean to obtain a NullBool Instance from.- Returns:
- NullBool Instance based on the provided
Boolean
value.
-
isNotSet
public boolean isNotSet()Returns whether the NullBool Instance is NullBool.NOT_SET.- Returns:
true
if the Instance is equal to NullBool.NOT_SET.
-
getOrDefault
public boolean getOrDefault(boolean def) Returns the NullBool's Boolean value or the provideddef
value, 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:
true
orfalse
based on the NullBool's Instance and the provideddef
value.
-