Package com.github.javaparser.ast.expr
Class Name
- java.lang.Object
-
- com.github.javaparser.ast.Node
-
- com.github.javaparser.ast.expr.Name
-
- All Implemented Interfaces:
NodeWithIdentifier<Name>,NodeWithRange<Node>,NodeWithTokenRange<Node>,Observable,Visitable,HasParentNode<Node>,Cloneable
public final class Name extends Node implements NodeWithIdentifier<Name>
A name that may consist of multiple identifiers. In other words: it.may.contain.dots.The rightmost identifier is "identifier", The one to the left of it is "qualifier.identifier", etc.
You can construct one from a String with the name(...) method.
- Author:
- Julio Vilmar Gesser
- See Also:
SimpleName
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.github.javaparser.ast.Node
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversal
-
-
Field Summary
-
Fields inherited from class com.github.javaparser.ast.Node
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration, SYMBOL_RESOLVER_KEY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <R,A>
Raccept(GenericVisitor<R,A> v, A arg)Accept method for visitor support.<A> voidaccept(VoidVisitor<A> v, A arg)Accept method for visitor support.StringasString()Nameclone()StringgetIdentifier()NameMetaModelgetMetaModel()Optional<Name>getQualifier()booleanisInternal()An internal name is a name that constitutes a part of a larger Name instance.booleanisTopLevel()A top level name is a name that is not contained in a larger Name instance.static Nameparse(String qualifiedName)Deprecated.use JavaParser.parseName insteadbooleanremove(Node node)NameremoveQualifier()booleanreplace(Node node, Node replacementNode)NamesetIdentifier(String identifier)NamesetQualifier(Name qualifier)-
Methods inherited from class com.github.javaparser.ast.Node
addOrphanComment, containsData, customInitialization, equals, findAll, findAll, findCompilationUnit, findFirst, findFirst, findFirst, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getSymbolResolver, getTokenRange, hasComment, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walk
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.HasParentNode
findAncestor, findAncestor, findParent, getAncestorOfType
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithIdentifier
getId, setId
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithRange
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
-
-
-
-
Method Detail
-
accept
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Description copied from interface:VisitableAccept method for visitor support.- Specified by:
acceptin interfaceVisitable- Type Parameters:
R- the type of the return value of the visitorA- the type the user argument passed to the visitor- Parameters:
v- the visitor implementationarg- the argument passed to the visitor (of type A)- Returns:
- the result of the visit (of type R)
-
accept
public <A> void accept(VoidVisitor<A> v, A arg)
Description copied from interface:VisitableAccept method for visitor support.
-
getIdentifier
public String getIdentifier()
- Specified by:
getIdentifierin interfaceNodeWithIdentifier<Name>
-
setIdentifier
public Name setIdentifier(String identifier)
- Specified by:
setIdentifierin interfaceNodeWithIdentifier<Name>
-
parse
@Deprecated public static Name parse(String qualifiedName)
Deprecated.use JavaParser.parseName insteadCreates a newNamefrom a qualified name.
The qualified name can contains "." (dot) characters.- Parameters:
qualifiedName- qualified name- Returns:
- instanceof
Name
-
asString
public String asString()
- Returns:
- the complete qualified name. Only the identifiers and the dots, so no comments or whitespace.
-
removeQualifier
public Name removeQualifier()
-
getMetaModel
public NameMetaModel getMetaModel()
- Overrides:
getMetaModelin classNode- Returns:
- get JavaParser specific node introspection information.
-
isTopLevel
public boolean isTopLevel()
A top level name is a name that is not contained in a larger Name instance.
-
isInternal
public boolean isInternal()
An internal name is a name that constitutes a part of a larger Name instance.
-
-