public class JavaParserFacade extends Object
Modifier and Type | Method and Description |
---|---|
com.github.javaparser.resolution.types.ResolvedType |
classToResolvedType(Class<?> clazz) |
static void |
clearInstances()
This method is used to clear internal caches for the sake of releasing memory.
|
com.github.javaparser.resolution.types.ResolvedType |
convert(com.github.javaparser.ast.type.Type type,
Context context) |
com.github.javaparser.resolution.types.ResolvedType |
convert(com.github.javaparser.ast.type.Type type,
com.github.javaparser.ast.Node node) |
com.github.javaparser.resolution.types.ResolvedType |
convertToUsage(com.github.javaparser.ast.type.Type type) |
protected com.github.javaparser.resolution.types.ResolvedType |
convertToUsage(com.github.javaparser.ast.type.Type type,
Context context) |
com.github.javaparser.resolution.types.ResolvedType |
convertToUsage(com.github.javaparser.ast.type.Type type,
com.github.javaparser.ast.Node context) |
com.github.javaparser.resolution.types.ResolvedType |
convertToUsageVariableType(com.github.javaparser.ast.body.VariableDeclarator var) |
protected com.github.javaparser.ast.body.TypeDeclaration<?> |
findContainingTypeDecl(com.github.javaparser.ast.Node node) |
protected com.github.javaparser.ast.Node |
findContainingTypeDeclOrObjectCreationExpr(com.github.javaparser.ast.Node node) |
static JavaParserFacade |
get(TypeSolver typeSolver) |
protected com.github.javaparser.resolution.types.ResolvedType |
getBinaryTypeConcrete(com.github.javaparser.ast.Node left,
com.github.javaparser.ast.Node right,
boolean solveLambdas) |
SymbolSolver |
getSymbolSolver() |
com.github.javaparser.resolution.types.ResolvedType |
getType(com.github.javaparser.ast.Node node)
Get the type associated with the node.
|
com.github.javaparser.resolution.types.ResolvedType |
getType(com.github.javaparser.ast.Node node,
boolean solveLambdas) |
com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration |
getTypeDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration classOrInterfaceDeclaration) |
com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration |
getTypeDeclaration(com.github.javaparser.ast.Node node) |
com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration |
getTypeDeclaration(com.github.javaparser.ast.body.TypeDeclaration<?> typeDeclaration) |
com.github.javaparser.resolution.types.ResolvedType |
getTypeOfThisIn(com.github.javaparser.ast.Node node)
"this" inserted in the given point, which type would have?
|
TypeSolver |
getTypeSolver() |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedAnnotationDeclaration> |
solve(com.github.javaparser.ast.expr.AnnotationExpr annotationExpr) |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> |
solve(com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt explicitConstructorInvocationStmt) |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> |
solve(com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt explicitConstructorInvocationStmt,
boolean solveLambdas) |
SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> |
solve(com.github.javaparser.ast.expr.Expression expr) |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration> |
solve(com.github.javaparser.ast.expr.FieldAccessExpr fieldAccessExpr) |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> |
solve(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr) |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> |
solve(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr,
boolean solveLambdas)
Given a method call find out to which method declaration it corresponds.
|
SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> |
solve(com.github.javaparser.ast.expr.NameExpr nameExpr) |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> |
solve(com.github.javaparser.ast.expr.ObjectCreationExpr objectCreationExpr) |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> |
solve(com.github.javaparser.ast.expr.ObjectCreationExpr objectCreationExpr,
boolean solveLambdas)
Given a constructor call find out to which constructor declaration it corresponds.
|
SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> |
solve(com.github.javaparser.ast.expr.SimpleName nameExpr) |
SymbolReference<com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration> |
solve(com.github.javaparser.ast.expr.ThisExpr node) |
protected static com.github.javaparser.resolution.types.ResolvedType |
solveGenericTypes(com.github.javaparser.resolution.types.ResolvedType type,
Context context,
TypeSolver typeSolver) |
com.github.javaparser.resolution.MethodUsage |
solveMethodAsUsage(com.github.javaparser.ast.expr.MethodCallExpr call) |
protected com.github.javaparser.resolution.MethodUsage |
toMethodUsage(com.github.javaparser.ast.expr.MethodReferenceExpr methodReferenceExpr) |
public TypeSolver getTypeSolver()
public SymbolSolver getSymbolSolver()
public static JavaParserFacade get(TypeSolver typeSolver)
public static void clearInstances()
protected static com.github.javaparser.resolution.types.ResolvedType solveGenericTypes(com.github.javaparser.resolution.types.ResolvedType type, Context context, TypeSolver typeSolver)
public SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> solve(com.github.javaparser.ast.expr.NameExpr nameExpr)
public SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> solve(com.github.javaparser.ast.expr.SimpleName nameExpr)
public SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> solve(com.github.javaparser.ast.expr.Expression expr)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solve(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> solve(com.github.javaparser.ast.expr.ObjectCreationExpr objectCreationExpr)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> solve(com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt explicitConstructorInvocationStmt)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> solve(com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt explicitConstructorInvocationStmt, boolean solveLambdas)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration> solve(com.github.javaparser.ast.expr.ThisExpr node)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration> solve(com.github.javaparser.ast.expr.ObjectCreationExpr objectCreationExpr, boolean solveLambdas)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration> solve(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr, boolean solveLambdas)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedAnnotationDeclaration> solve(com.github.javaparser.ast.expr.AnnotationExpr annotationExpr)
public SymbolReference<com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration> solve(com.github.javaparser.ast.expr.FieldAccessExpr fieldAccessExpr)
public com.github.javaparser.resolution.types.ResolvedType getType(com.github.javaparser.ast.Node node)
int foo(int a) {
return a; // when getType is invoked on "a" it returns the type "int"
}
Now, users started using also of names of types itself, which do not have a type.
For example:
class A {
int foo(int a) {
return A.someStaticField; // when getType is invoked on "A", which represents a class, it returns
// the type "A" itself while it used to throw UnsolvedSymbolException
}
To accomodate this usage and avoid confusion this method return
the type itself when used on the name of type.public com.github.javaparser.resolution.types.ResolvedType getType(com.github.javaparser.ast.Node node, boolean solveLambdas)
protected com.github.javaparser.resolution.MethodUsage toMethodUsage(com.github.javaparser.ast.expr.MethodReferenceExpr methodReferenceExpr)
protected com.github.javaparser.resolution.types.ResolvedType getBinaryTypeConcrete(com.github.javaparser.ast.Node left, com.github.javaparser.ast.Node right, boolean solveLambdas)
protected com.github.javaparser.ast.body.TypeDeclaration<?> findContainingTypeDecl(com.github.javaparser.ast.Node node)
protected com.github.javaparser.ast.Node findContainingTypeDeclOrObjectCreationExpr(com.github.javaparser.ast.Node node)
public com.github.javaparser.resolution.types.ResolvedType convertToUsageVariableType(com.github.javaparser.ast.body.VariableDeclarator var)
public com.github.javaparser.resolution.types.ResolvedType convertToUsage(com.github.javaparser.ast.type.Type type, com.github.javaparser.ast.Node context)
public com.github.javaparser.resolution.types.ResolvedType convertToUsage(com.github.javaparser.ast.type.Type type)
protected com.github.javaparser.resolution.types.ResolvedType convertToUsage(com.github.javaparser.ast.type.Type type, Context context)
public com.github.javaparser.resolution.types.ResolvedType convert(com.github.javaparser.ast.type.Type type, com.github.javaparser.ast.Node node)
public com.github.javaparser.resolution.types.ResolvedType convert(com.github.javaparser.ast.type.Type type, Context context)
public com.github.javaparser.resolution.MethodUsage solveMethodAsUsage(com.github.javaparser.ast.expr.MethodCallExpr call)
public com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration getTypeDeclaration(com.github.javaparser.ast.Node node)
public com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration getTypeDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration classOrInterfaceDeclaration)
public com.github.javaparser.resolution.types.ResolvedType getTypeOfThisIn(com.github.javaparser.ast.Node node)
public com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration getTypeDeclaration(com.github.javaparser.ast.body.TypeDeclaration<?> typeDeclaration)
public com.github.javaparser.resolution.types.ResolvedType classToResolvedType(Class<?> clazz)
Copyright © 2007–2018. All rights reserved.