Class NameLogic
java.lang.Object
com.github.javaparser.symbolsolver.resolution.naming.NameLogic
NameLogic contains a set of static methods to implement the abstraction of a "Name" as defined
in Chapter 6 of the JLS. This code could be moved to an interface or base class in a successive version of
JavaParser.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic NameCategory
classifyReference(Node name, TypeSolver typeSolver)
static NameRole
classifyRole(Node name)
What is the Role of the given name? Does it represent a Declaration or a Reference?static boolean
Does the Node represent a Name?static boolean
isQualifiedName(Node node)
Is the given node a qualified name?static boolean
isSimpleName(Node node)
Is the given node a non-qualified name?static String
nameAsString(Node name)
Return the string representation of the namestatic NameCategory
See JLS 6.5.1 Syntactic Classification of a Name According to Context.
-
Constructor Details
-
NameLogic
public NameLogic()
-
-
Method Details
-
isSimpleName
Is the given node a non-qualified name?- Throws:
IllegalArgumentException
- if the node is not a name
-
isQualifiedName
Is the given node a qualified name?- Throws:
IllegalArgumentException
- if the node is not a name
-
isAName
Does the Node represent a Name?Note that while most specific AST classes either always represent names or never represent names there are exceptions as the FieldAccessExpr
-
classifyRole
What is the Role of the given name? Does it represent a Declaration or a Reference?This classification is purely syntactical, i.e., it does not require symbol resolution. For this reason in the future this could be moved to the core module of JavaParser.
-
classifyReference
-
syntacticClassificationAccordingToContext
See JLS 6.5.1 Syntactic Classification of a Name According to Context.Most users do not want to call directly this method but call classifyReference instead.
-
nameAsString
Return the string representation of the name
-