Class TypePattern


public class TypePattern extends Pattern
TypePattern pattern AST node type.
 TypePattern:
      VariableDeclaration
 
Since:
3.27
Restriction:
This class is not intended to be instantiated by clients.
  • Field Details

  • 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.38
    • propertyDescriptors

      public static List propertyDescriptors(int apiLevel, boolean previewEnabled)
      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.38
    • setPatternVariable

      @Deprecated(forRemoval=true, since="2025-03") public void setPatternVariable(SingleVariableDeclaration patternVariable)
      Deprecated, for removal: This API element is subject to removal in a future version.
      In the JLS22 API, this method is replaced by setPatternVariable(VariableDeclaration patternVariable)
      Sets the pattern variable.
      Parameters:
      patternVariable - the right operand node
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
      • a cycle in would be created
      UnsupportedOperationException - if this operation is used other than JLS19
      UnsupportedOperationException - if this expression is used with previewEnabled flag as false
      Since:
      3.38
    • setPatternVariable

      public void setPatternVariable(VariableDeclaration patternVariable2)
      Sets the pattern variable. Supports JLS22 and higher versions
      Parameters:
      patternVariable2 - the right operand node
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
      • a cycle in would be created
      UnsupportedOperationException - if this operation is used other than JLS22
      UnsupportedOperationException - if this expression is used with previewEnabled flag as false
      Since:
      3.39
    • getPatternVariable

      public SingleVariableDeclaration getPatternVariable()
      Returns the pattern variable of Types Pattern.
      Returns:
      the pattern variable
      Throws:
      UnsupportedOperationException - if this operation is used other than JLS19
      UnsupportedOperationException - if this expression is used with previewEnabled flag as false In the JLS22 API, this method is replaced by getPatternVariable2()
      Since:
      3.38
    • getPatternVariable2

      public VariableDeclaration getPatternVariable2()
      Returns the pattern variable of Types Pattern.
      Returns:
      the pattern variable
      Throws:
      UnsupportedOperationException - if this operation is used other than JLS22
      UnsupportedOperationException - if this expression is used with previewEnabled flag as false
      Since:
      3.39