Class RecordDeclaration


public class RecordDeclaration extends AbstractTypeDeclaration
Record declaration AST node type (added in JLS16 API).
 RecordDeclaration:
     [ Javadoc ] { ExtendedModifier } record Identifier
                [ < TypeParameter > ]
                (
                [ FormalParameter { , FormalParameter } ]
                ) { Dimension }
                [ implements Type { , Type } ]
                [ ; { RecordBodyDeclaration | ; } ]
 
The AbstractTypeDeclaration.bodyDeclarations() list holds the class body declarations that appear after the semicolon.

When a Javadoc comment is present, the source range begins with the first character of the "/**" comment delimiter. When there is no Javadoc comment, the source range begins with the first character of the first modifier or annotation (if present), or the first character of the "record" keyword (if no modifiers or annotations). The source range extends through the last character of the "}" token following the body declarations.

Since:
3.26
  • Field Details

  • Method Details

    • setRestrictedIdentifierStartPosition

      public void setRestrictedIdentifierStartPosition(int restrictedIdentifierStartPosition)
      Since:
      3.26
    • getRestrictedIdentifierStartPosition

      public int getRestrictedIdentifierStartPosition()
      Returns:
      restrictedIdentifierStartPosition
      Since:
      3.26
    • 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.26
    • typeParameters

      public List typeParameters()
      Returns the live ordered list of type parameters of this type declaration (added in JLS3 API). This list is non-empty for parameterized types.
      Returns:
      the live list of type parameters (element type: TypeParameter)
      Since:
      3.26
    • superInterfaceTypes

      public List superInterfaceTypes()
      Returns the live ordered list of superinterfaces of this type declaration (added in JLS3 API). For a class declaration, these are the interfaces that this class implements; for an interface declaration, these are the interfaces that this interface extends.
      Returns:
      the live list of interface types (element type: Type)
      Since:
      3.26
    • recordComponents

      public List recordComponents()
      Returns the live ordered list of recordComponents of record declaration.
      Returns:
      the live list of recordComponents (element type: SingleVariableDeclaration)
      Since:
      3.26
    • getFields

      public FieldDeclaration[] getFields()
      Returns the ordered list of field declarations of this type declaration. For a class declaration, these are the field declarations; for an interface declaration, these are the constant declarations.

      This convenience method returns this node's body declarations with non-fields filtered out. Unlike bodyDeclarations, this method does not return a live result.

      Returns:
      the (possibly empty) list of field declarations
      Since:
      3.26
    • getMethods

      public MethodDeclaration[] getMethods()
      Returns the ordered list of method declarations of this type declaration.

      This convenience method returns this node's body declarations with non-methods filtered out. Unlike bodyDeclarations, this method does not return a live result.

      Returns:
      the (possibly empty) list of method (and constructor) declarations
      Since:
      3.26