Class BreakStmt

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

    public final class BreakStmt
    extends Statement

    The break statement

    Java 1.0-11

    Break has an optional label:
    break;
    break somewhere;
    The label is in the "value" property as a NameExpr.

    Java 12

    Break can now also have any expression, to be used in the switch-expression:
    break 123+456;
    break "more or less";
    The expression will be in the "value" property.
    Author:
    Julio Vilmar Gesser
    See Also:
    SwitchExpr
    • Constructor Detail

      • BreakStmt

        public BreakStmt()
      • BreakStmt

        public BreakStmt​(String label)
      • BreakStmt

        public BreakStmt​(Expression value)
      • BreakStmt

        public BreakStmt​(TokenRange tokenRange,
                         Expression value)
        This constructor is used by the parser and is considered private.
    • Method Detail

      • 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)
      • setValue

        public BreakStmt setValue​(Expression value)
        Sets the label
        Parameters:
        value - the label or the expression, can be null
        Returns:
        this, the BreakStmt
      • removeValue

        public BreakStmt removeValue()