Class JavaSymbolSolver
java.lang.Object
com.github.javaparser.symbolsolver.JavaSymbolSolver
- All Implemented Interfaces:
SymbolResolver
This implementation of the SymbolResolver wraps the functionality of the library to make them easily usable
from JavaParser nodes.
An instance of this class should be created once and then injected in all the CompilationUnit for which we
want to enable symbol resolution. To do so the method inject can be used, or you can use
ParserConfiguration.setSymbolResolver(SymbolResolver) and the parser will do the
injection for you.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateType(Expression expression) For an expression it would find the corresponding resolved type.voidinject(CompilationUnit destination) Register this SymbolResolver into a CompilationUnit, so that symbol resolution becomes available to all nodes part of the CompilationUnit.<T> TresolveDeclaration(Node node, Class<T> resultClass) For a reference it would find the corresponding declaration.private Optional<ResolvedParameterDeclaration> resolveParameterDeclaration(Parameter parameter) private Optional<ResolvedParameterDeclaration> resolveParameterDeclaration(ResolvedMethodLikeDeclaration resolvedMethodLikeDeclaration, Parameter parameter) private Optional<ResolvedParameterDeclaration> resolveParameterDeclaration(ResolvedReferenceTypeDeclaration resolvedReferenceTypeDeclaration, Parameter parameter) <T> TtoResolvedType(Type javaparserType, Class<T> resultClass) For types it would find the corresponding resolved types.toTypeDeclaration(Node node) For a node it would find the corresponding reference type declaration.
-
Field Details
-
typeSolver
-
-
Constructor Details
-
JavaSymbolSolver
-
-
Method Details
-
inject
Register this SymbolResolver into a CompilationUnit, so that symbol resolution becomes available to all nodes part of the CompilationUnit. -
resolveDeclaration
Description copied from interface:SymbolResolverFor a reference it would find the corresponding declaration.- Specified by:
resolveDeclarationin interfaceSymbolResolver
-
resolveParameterDeclaration
private Optional<ResolvedParameterDeclaration> resolveParameterDeclaration(ResolvedMethodLikeDeclaration resolvedMethodLikeDeclaration, Parameter parameter) -
resolveParameterDeclaration
private Optional<ResolvedParameterDeclaration> resolveParameterDeclaration(ResolvedReferenceTypeDeclaration resolvedReferenceTypeDeclaration, Parameter parameter) -
resolveParameterDeclaration
-
toResolvedType
Description copied from interface:SymbolResolverFor types it would find the corresponding resolved types.- Specified by:
toResolvedTypein interfaceSymbolResolver
-
calculateType
Description copied from interface:SymbolResolverFor an expression it would find the corresponding resolved type.- Specified by:
calculateTypein interfaceSymbolResolver
-
toTypeDeclaration
Description copied from interface:SymbolResolverFor a node it would find the corresponding reference type declaration.- Specified by:
toTypeDeclarationin interfaceSymbolResolver
-