Class AssertStmt

All Implemented Interfaces:
NodeWithRange<Node>, NodeWithTokenRange<Node>, Observable, Visitable, HasParentNode<Node>, Cloneable

public class AssertStmt extends Statement
A usage of the keyword "assert"
In assert dead : "Wasn't expecting to be dead here"; the check is "dead" and the message is the string.
Author:
Julio Vilmar Gesser
  • Constructor Details

    • AssertStmt

      public AssertStmt()
    • AssertStmt

      public AssertStmt(Expression check)
    • AssertStmt

      public AssertStmt(Expression check, Expression message)
    • AssertStmt

      public AssertStmt(TokenRange tokenRange, Expression check, Expression message)
      This constructor is used by the parser and is considered private.
  • Method Details

    • accept

      public <R,​ A> R accept(GenericVisitor<R,​A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Type Parameters:
      R - the type of the return value of the visitor
      A - the type the user argument passed to the visitor
      Parameters:
      v - the visitor implementation
      arg - the argument passed to the visitor (of type A)
      Returns:
      the result of the visit (of type R)
    • accept

      public <A> void accept(VoidVisitor<A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Type Parameters:
      A - the type the argument passed for the visitor
      Parameters:
      v - the visitor implementation
      arg - any value relevant for the visitor (of type A)
    • getCheck

      public Expression getCheck()
    • getMessage

      public Optional<Expression> getMessage()
    • setCheck

      public AssertStmt setCheck(Expression check)
    • setMessage

      public AssertStmt setMessage(Expression message)
      Sets the message
      Parameters:
      message - the message, can be null
      Returns:
      this, the AssertStmt
    • remove

      public boolean remove(Node node)
      Overrides:
      remove in class Node
    • removeMessage

      public AssertStmt removeMessage()
    • clone

      public AssertStmt clone()
      Overrides:
      clone in class Statement
    • getMetaModel

      public AssertStmtMetaModel getMetaModel()
      Overrides:
      getMetaModel in class Statement
      Returns:
      get JavaParser specific node introspection information.
    • replace

      public boolean replace(Node node, Node replacementNode)
      Overrides:
      replace in class Node
    • isAssertStmt

      public boolean isAssertStmt()
      Overrides:
      isAssertStmt in class Statement
    • asAssertStmt

      public AssertStmt asAssertStmt()
      Overrides:
      asAssertStmt in class Statement
    • ifAssertStmt

      public void ifAssertStmt(Consumer<AssertStmt> action)
      Overrides:
      ifAssertStmt in class Statement
    • toAssertStmt

      public Optional<AssertStmt> toAssertStmt()
      Overrides:
      toAssertStmt in class Statement