Class NullNode

java.lang.Object
software.amazon.smithy.model.node.Node
software.amazon.smithy.model.node.NullNode
All Implemented Interfaces:
FromSourceLocation, ToNode

public final class NullNode extends Node
Represents a null node.
  • Constructor Details

  • Method Details

    • getType

      public NodeType getType()
      Description copied from class: Node
      Gets the type of the node.
      Specified by:
      getType in class Node
      Returns:
      Returns the node type.
    • accept

      public <R> R accept(NodeVisitor<R> visitor)
      Description copied from class: Node
      Accepts a visitor with the node.
      Specified by:
      accept in class Node
      Type Parameters:
      R - visitor return type.
      Parameters:
      visitor - Visitor to dispatch to.
      Returns:
      Returns the accepted result.
    • expectNullNode

      public NullNode expectNullNode(String errorMessage)
      Description copied from class: Node
      Casts the current node to a NullNode, throwing ExpectationNotMetException when the node is the wrong type.
      Overrides:
      expectNullNode in class Node
      Parameters:
      errorMessage - Error message to use if the node is of the wrong type.
      Returns:
      Returns a null node.
    • expectNullNode

      public NullNode expectNullNode(Supplier<String> errorMessage)
      Description copied from class: Node
      Casts the current node to a NullNode, throwing ExpectationNotMetException when the node is the wrong type.
      Overrides:
      expectNullNode in class Node
      Parameters:
      errorMessage - Error message supplier.
      Returns:
      Returns a null node.
    • asNullNode

      public Optional<NullNode> asNullNode()
      Description copied from class: Node
      Gets the node as an NullNode if it is a null.
      Overrides:
      asNullNode in class Node
      Returns:
      Returns the optional NullNode.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object