Record Class BooleanValue
java.lang.Object
java.lang.Record
com.github.siroshun09.configapi.core.node.BooleanValue
- Record Components:
booleanValue
- a boolean
- All Implemented Interfaces:
Node<Boolean>
,StringRepresentable
,ValueNode<Boolean>
public record BooleanValue(boolean booleanValue)
extends Record
implements ValueNode<Boolean>, StringRepresentable
A
Node
implementation that holds a boolean value.-
Field Summary
Modifier and TypeFieldDescriptionstatic final BooleanValue
An instance ofBooleanValue
that indicatesfalse
.static final BooleanValue
An instance ofBooleanValue
that indicatestrue
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull VisitResult
accept
(@NotNull NodeVisitor visitor) Accepts aNodeVisitor
for thisNode
.boolean
Gets the value as a primitive boolean.@NotNull String
asString()
Represents as aString
.boolean
Returns the value of thebooleanValue
record component.final boolean
Indicates whether some other object is "equal to" this one.static @NotNull BooleanValue
fromBoolean
(boolean bool) Creates aBooleanValue
from the given boolean.static @NotNull BooleanValue
fromBoolean
(@Nullable Boolean bool) Creates aBooleanValue
from the givenBoolean
.final int
hashCode()
Returns a hash code value for this object.boolean
hasValue()
Checks if thisNode
holds an object.final String
toString()
Returns a string representation of this record class.@NotNull Boolean
value()
Gets an object which thisNode
holdsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.github.siroshun09.configapi.core.node.Node
asOptional
-
Field Details
-
TRUE
An instance ofBooleanValue
that indicatestrue
. -
FALSE
An instance ofBooleanValue
that indicatesfalse
.
-
-
Constructor Details
-
BooleanValue
@Internal public BooleanValue(boolean booleanValue) A constructor ofBooleanValue
.This constructor is marked as
ApiStatus.Internal
. Please use constants (TRUE
orFALSE
) or static methods (fromBoolean(Boolean)
orfromBoolean(boolean)
).- Parameters:
booleanValue
- a boolean to createBooleanValue
-
-
Method Details
-
fromBoolean
Creates aBooleanValue
from the givenBoolean
.- Parameters:
bool
- aBoolean
to createBooleanValue
- Returns:
TRUE
if the givenBoolean
equalsBoolean.TRUE
, otherwiseFALSE
-
fromBoolean
Creates aBooleanValue
from the given boolean.- Parameters:
bool
- a boolean to createBooleanValue
- Returns:
TRUE
if the given boolean istrue
, otherwiseFALSE
-
value
Description copied from interface:Node
Gets an object which thisNode
holds -
hasValue
public boolean hasValue()Description copied from interface:Node
Checks if thisNode
holds an object.The default implementation of this method checks if the returning value from
Node.value()
is notnull
. -
asBoolean
public boolean asBoolean()Gets the value as a primitive boolean.This method returns the same value as
booleanValue()
.- Returns:
- a primitive boolean
-
accept
Description copied from interface:Node
Accepts aNodeVisitor
for thisNode
.- Specified by:
accept
in interfaceNode<Boolean>
- Parameters:
visitor
- aNodeVisitor
to accept- Returns:
- a
VisitResult
-
asString
Description copied from interface:StringRepresentable
Represents as aString
.- Specified by:
asString
in interfaceStringRepresentable
- Returns:
- a
String
representation of this node
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
booleanValue
public boolean booleanValue()Returns the value of thebooleanValue
record component.- Returns:
- the value of the
booleanValue
record component
-