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
FieldsModifier and TypeFieldDescriptionstatic final BooleanValueAn instance ofBooleanValuethat indicatesfalse.static final BooleanValueAn instance ofBooleanValuethat indicatestrue. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull VisitResultaccept(@NotNull NodeVisitor visitor) Accepts aNodeVisitorfor thisNode.booleanGets the value as a primitive boolean.@NotNull StringasString()Represents as aString.booleanReturns the value of thebooleanValuerecord component.final booleanIndicates whether some other object is "equal to" this one.static @NotNull BooleanValuefromBoolean(boolean bool) Creates aBooleanValuefrom the given boolean.static @NotNull BooleanValuefromBoolean(@Nullable Boolean bool) Creates aBooleanValuefrom the givenBoolean.final inthashCode()Returns a hash code value for this object.booleanhasValue()Checks if thisNodeholds an object.final StringtoString()Returns a string representation of this record class.@NotNull Booleanvalue()Gets an object which thisNodeholdsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.github.siroshun09.configapi.core.node.Node
asOptional
-
Field Details
-
TRUE
An instance ofBooleanValuethat indicatestrue. -
FALSE
An instance ofBooleanValuethat indicatesfalse.
-
-
Constructor Details
-
BooleanValue
@Internal public BooleanValue(boolean booleanValue) A constructor ofBooleanValue.This constructor is marked as
ApiStatus.Internal. Please use constants (TRUEorFALSE) or static methods (fromBoolean(Boolean)orfromBoolean(boolean)).- Parameters:
booleanValue- a boolean to createBooleanValue
-
-
Method Details
-
fromBoolean
Creates aBooleanValuefrom the givenBoolean.- Parameters:
bool- aBooleanto createBooleanValue- Returns:
TRUEif the givenBooleanequalsBoolean.TRUE, otherwiseFALSE
-
fromBoolean
Creates aBooleanValuefrom the given boolean.- Parameters:
bool- a boolean to createBooleanValue- Returns:
TRUEif the given boolean istrue, otherwiseFALSE
-
value
Description copied from interface:NodeGets an object which thisNodeholds -
hasValue
public boolean hasValue()Description copied from interface:NodeChecks if thisNodeholds 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:NodeAccepts aNodeVisitorfor thisNode.- Specified by:
acceptin interfaceNode<Boolean>- Parameters:
visitor- aNodeVisitorto accept- Returns:
- a
VisitResult
-
asString
Description copied from interface:StringRepresentableRepresents as aString.- Specified by:
asStringin interfaceStringRepresentable- Returns:
- a
Stringrepresentation 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 thebooleanValuerecord component.- Returns:
- the value of the
booleanValuerecord component
-