Class BreakStatement


public class BreakStatement extends Statement
Break statement AST node type.
 BreakStatement:
    break [ Identifier ] ;

    Break statement allows expression as part of Java 12 preview feature (JEP 325)
                break { Identifier | Expression }
 
Since:
2.0
Restriction:
This class is not intended to be instantiated by clients.
  • Field Details

    • LABEL_PROPERTY

      public static final ChildPropertyDescriptor LABEL_PROPERTY
      The "label" structural property of this node type (child type: SimpleName).
      Since:
      3.0
    • EXPRESSION_PROPERTY

      public static final ChildPropertyDescriptor EXPRESSION_PROPERTY
      Deprecated.
      The "expression" structural property of this node type (child type: Expression). (added in JEP 325).
      Since:
      3.18
      Restriction:
      This property is not intended to be referenced by clients as it is a part of Java preview feature.
  • Method Details

    • propertyDescriptors

      public static List propertyDescriptors(int apiLevel)
      Returns a list of structural property descriptors for this node type. Clients must not modify the result.
      Parameters:
      apiLevel - the API level; one of the AST.JLS* constants
      Returns:
      a list of property descriptors (element type: StructuralPropertyDescriptor)
      Since:
      3.0
    • propertyDescriptors

      public static List propertyDescriptors(int apiLevel, boolean previewEnabled)
      Deprecated.
      Returns a list of structural property descriptors for this node type. Clients must not modify the result.
      Parameters:
      apiLevel - the API level; one of the AST.JLS* constants
      previewEnabled - the previewEnabled flag
      Returns:
      a list of property descriptors (element type: StructuralPropertyDescriptor)
      Since:
      3.20
      Restriction:
      This method is not intended to be referenced by clients as it is a part of Java preview feature.
    • getLabel

      public SimpleName getLabel()
      Returns the label of this break statement, or null if there is none.
      Returns:
      the label, or null if there is none
    • setLabel

      public void setLabel(SimpleName label)
      Sets or clears the label of this break statement.
      Parameters:
      label - the label, or null if there is none
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
    • getExpression

      public Expression getExpression()
      Deprecated.
      Returns the expression of this break statement, or null if there is none.
      Returns:
      the expression, or null if there is none
      Throws:
      UnsupportedOperationException - if this operation is used other than JLS12
      Since:
      3.18
      Restriction:
      This method is not intended to be referenced by clients as it is a part of Java preview feature.
      Restriction:
      This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
    • setExpression

      public void setExpression(Expression expression)
      Deprecated.
      Sets or clears the expression of this break statement.
      Parameters:
      expression - the expression, or null if there is none
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
      UnsupportedOperationException - if this operation is used other than JLS12
      Since:
      3.18
      Restriction:
      This method is not intended to be referenced by clients as it is a part of Java preview feature.
      Restriction:
      This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
    • isImplicit

      public boolean isImplicit()
      Deprecated.
      Gets the isImplicit of this break statement as true or false. true indicates implicit and false indicates not implicit.
      Returns:
      isImplicit true or false
      Throws:
      UnsupportedOperationException - if this operation is used other than JLS12
      Since:
      3.18
      Restriction:
      This method is not intended to be referenced by clients as it is a part of Java preview feature.
      Restriction:
      This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.