Interface LocalDeclaration

All Known Implementing Classes:
ExpressionStmtVariableDeclaration, ForEachDeclaration, ForInitDeclaration, LocalVariableDeclaration, ParameterDeclaration, TryResourceDeclaration

public interface LocalDeclaration
A local declaration. Either a local variable declaration, a formal parameter, or an exception parameter.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Stream<com.github.javaparser.ast.expr.MethodCallExpr>
    Finds all method calls for the variable/parameter in this declaration.
    default Stream<com.github.javaparser.ast.expr.NameExpr>
    Finds all references to this variable/parameter in its scope.
    com.github.javaparser.ast.Node
    The node where the declaration occurs.
    Returns the name used in this declaration as a String.
    The scope of this declaration.
    default boolean
    isReference(com.github.javaparser.ast.expr.NameExpr reference)
    Verifies if a given NameExpr is a reference to this variable/parameter.
  • Method Details

    • getName

      String getName()
      Returns the name used in this declaration as a String.
    • getDeclaration

      com.github.javaparser.ast.Node getDeclaration()
      The node where the declaration occurs.
    • getScope

      LocalScope getScope()
      The scope of this declaration.
    • isReference

      default boolean isReference(com.github.javaparser.ast.expr.NameExpr reference)
      Verifies if a given NameExpr is a reference to this variable/parameter.
    • findAllReferences

      default Stream<com.github.javaparser.ast.expr.NameExpr> findAllReferences()
      Finds all references to this variable/parameter in its scope.
    • findAllMethodCalls

      default Stream<com.github.javaparser.ast.expr.MethodCallExpr> findAllMethodCalls()
      Finds all method calls for the variable/parameter in this declaration.