Class BooleanNode
- java.lang.Object
-
- software.amazon.smithy.model.node.Node
-
- software.amazon.smithy.model.node.BooleanNode
-
- All Implemented Interfaces:
FromSourceLocation,ToNode
public final class BooleanNode extends Node
Represents a boolean node.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.smithy.model.node.Node
Node.NonNumericFloat
-
-
Constructor Summary
Constructors Constructor Description BooleanNode(boolean value, SourceLocation sourceLocation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> Raccept(NodeVisitor<R> visitor)Accepts a visitor with the node.java.util.Optional<BooleanNode>asBooleanNode()Gets the node as an BooleanNode if it is an boolean.booleanequals(java.lang.Object other)BooleanNodeexpectBooleanNode(java.lang.String errorMessage)Casts the current node to aBooleanNode, throwingExpectationNotMetExceptionwhen the node is the wrong type.BooleanNodeexpectBooleanNode(java.util.function.Supplier<java.lang.String> errorMessage)Casts the current node to aBooleanNode, throwingExpectationNotMetExceptionwhen the node is the wrong type.NodeTypegetType()Gets the type of the node.booleangetValue()Gets the true or false value of the boolean node.inthashCode()java.lang.StringtoString()-
Methods inherited from class software.amazon.smithy.model.node.Node
arrayNode, arrayNode, asArrayNode, asNullNode, asNumberNode, asObjectNode, assertEquals, asStringNode, diff, expectArrayNode, expectArrayNode, expectArrayNode, expectBooleanNode, expectNullNode, expectNullNode, expectNullNode, expectNumberNode, expectNumberNode, expectNumberNode, expectObjectNode, expectObjectNode, expectObjectNode, expectStringNode, expectStringNode, expectStringNode, from, from, from, from, fromNodes, fromNodes, fromStrings, fromStrings, getSourceLocation, isArrayNode, isBooleanNode, isNullNode, isNumberNode, isObjectNode, isStringNode, loadArrayOfString, nullNode, objectNode, objectNode, objectNodeBuilder, parse, parse, parse, parse, parseJsonWithComments, parseJsonWithComments, prettyPrintJson, prettyPrintJson, printJson, toNode, withDeepSortedKeys, withDeepSortedKeys
-
-
-
-
Constructor Detail
-
BooleanNode
public BooleanNode(boolean value, SourceLocation sourceLocation)
-
-
Method Detail
-
getValue
public boolean getValue()
Gets the true or false value of the boolean node.- Returns:
- Returns true or false.
-
accept
public <R> R accept(NodeVisitor<R> visitor)
Description copied from class:NodeAccepts a visitor with the node.
-
expectBooleanNode
public BooleanNode expectBooleanNode(java.lang.String errorMessage)
Description copied from class:NodeCasts the current node to aBooleanNode, throwingExpectationNotMetExceptionwhen the node is the wrong type.- Overrides:
expectBooleanNodein classNode- Parameters:
errorMessage- Error message to use if the node is of the wrong type.- Returns:
- Returns a boolean node.
-
expectBooleanNode
public BooleanNode expectBooleanNode(java.util.function.Supplier<java.lang.String> errorMessage)
Description copied from class:NodeCasts the current node to aBooleanNode, throwingExpectationNotMetExceptionwhen the node is the wrong type.- Overrides:
expectBooleanNodein classNode- Parameters:
errorMessage- Error message supplier.- Returns:
- Returns a boolean node.
-
asBooleanNode
public java.util.Optional<BooleanNode> asBooleanNode()
Description copied from class:NodeGets the node as an BooleanNode if it is an boolean.- Overrides:
asBooleanNodein classNode- Returns:
- Returns the optional BooleanNode.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-