Skip to content

Commit

Permalink
add Javadoc to NameLogic
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomassetti committed Jul 25, 2018
1 parent 741bb67 commit 69c04cc
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,24 @@
import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.type.TypeParameter;

/**
* 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.
*/
public class NameLogic {

public static boolean isSimpleName(Node node) {
return !isQualifiedName(node);
}

public static boolean isQualifiedName(Node node) {
if (!isAName(node)) {
throw new IllegalArgumentException();
}
return nameAsString(node).contains(".");
}

public static boolean isAName(Node node) {
if (node instanceof FieldAccessExpr) {
FieldAccessExpr fieldAccessExpr = (FieldAccessExpr)node;
Expand Down

0 comments on commit 69c04cc

Please sign in to comment.