Interface Context
-
- All Known Implementing Classes:
AbstractJavaParserContext
,AbstractMethodLikeDeclarationContext
,AnonymousClassDeclarationContext
,BlockStmtContext
,CatchClauseContext
,ClassOrInterfaceDeclarationContext
,CompilationUnitContext
,ConstructorContext
,EnumDeclarationContext
,FieldAccessContext
,ForEachStatementContext
,ForStatementContext
,LambdaExprContext
,MethodCallExprContext
,MethodContext
,ObjectCreationContext
,StatementContext
,SwitchEntryContext
,TryWithResourceContext
,VariableDeclarationExprContext
,VariableDeclaratorContext
public interface Context
Context is very similar to scope. In the context we look for solving symbols.- Author:
- Federico Tomassetti
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Optional<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration>
fieldDeclarationInScope(String name)
default List<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration>
fieldsExposedToChild(com.github.javaparser.ast.Node child)
The fields that are declared and in this immediate context made visible to a given child.Context
getParent()
default Optional<com.github.javaparser.ast.body.VariableDeclarator>
localVariableDeclarationInScope(String name)
Aim to resolve the given name by looking for a variable matching it.default List<com.github.javaparser.ast.body.VariableDeclarator>
localVariablesExposedToChild(com.github.javaparser.ast.Node child)
The local variables that are declared in this immediate context and made visible to a given child.default Optional<com.github.javaparser.ast.body.Parameter>
parameterDeclarationInScope(String name)
default List<com.github.javaparser.ast.body.Parameter>
parametersExposedToChild(com.github.javaparser.ast.Node child)
The parameters that are declared in this immediate context and made visible to a given child.default com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration>
solveConstructor(List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes)
We find the method declaration which is the best match for the given name and list of typeParametersValues.default Optional<com.github.javaparser.resolution.types.ResolvedType>
solveGenericType(String name)
default com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration>
solveMethod(String name, List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes, boolean staticOnly)
We find the method declaration which is the best match for the given name and list of typeParametersValues.default Optional<com.github.javaparser.resolution.MethodUsage>
solveMethodAsUsage(String name, List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes)
Similar to solveMethod but we return a MethodUsage.default com.github.javaparser.symbolsolver.model.resolution.SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration>
solveSymbol(String name)
default Optional<com.github.javaparser.symbolsolver.model.resolution.Value>
solveSymbolAsValue(String name)
default com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration>
solveType(String name)
-
-
-
Method Detail
-
getParent
Context getParent()
-
solveGenericType
default Optional<com.github.javaparser.resolution.types.ResolvedType> solveGenericType(String name)
-
solveType
default com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration> solveType(String name)
-
solveSymbol
default com.github.javaparser.symbolsolver.model.resolution.SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> solveSymbol(String name)
-
solveSymbolAsValue
default Optional<com.github.javaparser.symbolsolver.model.resolution.Value> solveSymbolAsValue(String name)
-
localVariablesExposedToChild
default List<com.github.javaparser.ast.body.VariableDeclarator> localVariablesExposedToChild(com.github.javaparser.ast.Node child)
The local variables that are declared in this immediate context and made visible to a given child. This list could include values which are shadowed.
-
parametersExposedToChild
default List<com.github.javaparser.ast.body.Parameter> parametersExposedToChild(com.github.javaparser.ast.Node child)
The parameters that are declared in this immediate context and made visible to a given child. This list could include values which are shadowed.
-
fieldsExposedToChild
default List<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration> fieldsExposedToChild(com.github.javaparser.ast.Node child)
The fields that are declared and in this immediate context made visible to a given child. This list could include values which are shadowed.
-
localVariableDeclarationInScope
default Optional<com.github.javaparser.ast.body.VariableDeclarator> localVariableDeclarationInScope(String name)
Aim to resolve the given name by looking for a variable matching it. To do it consider local variables that are visible in a certain scope as defined in JLS 6.3. Scope of a Declaration. 1. The scope of a local variable declaration in a block (§14.4) is the rest of the block in which the declaration appears, starting with its own initializer and including any further declarators to the right in the local variable declaration statement. 2. The scope of a local variable declared in the ForInit part of a basic for statement (§14.14.1) includes all of the following: 2.1 Its own initializer 2.2 Any further declarators to the right in the ForInit part of the for statement 2.3 The Expression and ForUpdate parts of the for statement 2.4 The contained Statement 3. The scope of a local variable declared in the FormalParameter part of an enhanced for statement (§14.14.2) is the contained Statement. 4. The scope of a parameter of an exception handler that is declared in a catch clause of a try statement (§14.20) is the entire block associated with the catch. 5. The scope of a variable declared in the ResourceSpecification of a try-with-resources statement (§14.20.3) is from the declaration rightward over the remainder of the ResourceSpecification and the entire try block associated with the try-with-resources statement.
-
parameterDeclarationInScope
default Optional<com.github.javaparser.ast.body.Parameter> parameterDeclarationInScope(String name)
-
fieldDeclarationInScope
default Optional<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration> fieldDeclarationInScope(String name)
-
solveConstructor
default com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> solveConstructor(List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes)
We find the method declaration which is the best match for the given name and list of typeParametersValues.
-
solveMethod
default com.github.javaparser.symbolsolver.model.resolution.SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solveMethod(String name, List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes, boolean staticOnly)
We find the method declaration which is the best match for the given name and list of typeParametersValues.
-
solveMethodAsUsage
default Optional<com.github.javaparser.resolution.MethodUsage> solveMethodAsUsage(String name, List<com.github.javaparser.resolution.types.ResolvedType> argumentsTypes)
Similar to solveMethod but we return a MethodUsage. A MethodUsage corresponds to a MethodDeclaration plus the resolved type variables.
-
-