Class NameLogic
- java.lang.Object
-
- com.github.javaparser.symbolsolver.resolution.naming.NameLogic
-
public class NameLogic extends Object
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
Constructors Constructor Description NameLogic()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NameCategory
classifyReference(com.github.javaparser.ast.Node name, com.github.javaparser.symbolsolver.model.resolution.TypeSolver typeSolver)
static NameRole
classifyRole(com.github.javaparser.ast.Node name)
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.static boolean
isAName(com.github.javaparser.ast.Node node)
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 FieldAccessExprstatic boolean
isQualifiedName(com.github.javaparser.ast.Node node)
Is the given node a qualified name?static boolean
isSimpleName(com.github.javaparser.ast.Node node)
Is the given node a non-qualified name?static String
nameAsString(com.github.javaparser.ast.Node name)
Return the string representation of the namestatic NameCategory
syntacticClassificationAccordingToContext(com.github.javaparser.ast.Node name)
See JLS 6.5.1 Syntactic Classification of a Name According to Context.
-
-
-
Method Detail
-
isSimpleName
public static boolean isSimpleName(com.github.javaparser.ast.Node node)
Is the given node a non-qualified name?- Throws:
IllegalArgumentException
- if the node is not a name
-
isQualifiedName
public static boolean isQualifiedName(com.github.javaparser.ast.Node node)
Is the given node a qualified name?- Throws:
IllegalArgumentException
- if the node is not a name
-
isAName
public static boolean isAName(com.github.javaparser.ast.Node node)
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
public static NameRole classifyRole(com.github.javaparser.ast.Node name)
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
public static NameCategory classifyReference(com.github.javaparser.ast.Node name, com.github.javaparser.symbolsolver.model.resolution.TypeSolver typeSolver)
-
syntacticClassificationAccordingToContext
public static NameCategory syntacticClassificationAccordingToContext(com.github.javaparser.ast.Node name)
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
public static String nameAsString(com.github.javaparser.ast.Node name)
Return the string representation of the name
-
-