Package com.github.javaparser.ast.expr
Class AnnotationExpr
- java.lang.Object
-
- com.github.javaparser.ast.Node
-
- com.github.javaparser.ast.expr.Expression
-
- com.github.javaparser.ast.expr.AnnotationExpr
-
- All Implemented Interfaces:
NodeWithName<AnnotationExpr>,NodeWithRange<Node>,NodeWithTokenRange<Node>,Observable,Visitable,HasParentNode<Node>,Resolvable<ResolvedAnnotationDeclaration>,Cloneable
- Direct Known Subclasses:
MarkerAnnotationExpr,NormalAnnotationExpr,SingleMemberAnnotationExpr
public abstract class AnnotationExpr extends Expression implements NodeWithName<AnnotationExpr>, Resolvable<ResolvedAnnotationDeclaration>
A base class for the different types of annotations.- Author:
- Julio Vilmar Gesser
-
-
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 Modifier and Type Field Description protected Namename-
Fields inherited from class com.github.javaparser.ast.Node
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration, SYMBOL_RESOLVER_KEY
-
-
Constructor Summary
Constructors Constructor Description AnnotationExpr()AnnotationExpr(Name name)AnnotationExpr(TokenRange tokenRange, Name name)This constructor is used by the parser and is considered private.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotationExprasAnnotationExpr()AnnotationExprclone()AnnotationExprMetaModelgetMetaModel()NamegetName()voidifAnnotationExpr(Consumer<AnnotationExpr> action)booleanisAnnotationExpr()booleanremove(Node node)booleanreplace(Node node, Node replacementNode)ResolvedAnnotationDeclarationresolve()Attempts to resolve the declaration corresponding to the annotation expression.AnnotationExprsetName(Name name)Optional<AnnotationExpr>toAnnotationExpr()-
Methods inherited from class com.github.javaparser.ast.expr.Expression
asArrayAccessExpr, asArrayCreationExpr, asArrayInitializerExpr, asAssignExpr, asBinaryExpr, asBooleanLiteralExpr, asCastExpr, asCharLiteralExpr, asClassExpr, asConditionalExpr, asDoubleLiteralExpr, asEnclosedExpr, asFieldAccessExpr, asInstanceOfExpr, asIntegerLiteralExpr, asLambdaExpr, asLiteralExpr, asLiteralStringValueExpr, asLongLiteralExpr, asMarkerAnnotationExpr, asMethodCallExpr, asMethodReferenceExpr, asNameExpr, asNormalAnnotationExpr, asNullLiteralExpr, asObjectCreationExpr, asSingleMemberAnnotationExpr, asStringLiteralExpr, asSuperExpr, asSwitchExpr, asThisExpr, asTypeExpr, asUnaryExpr, asVariableDeclarationExpr, calculateResolvedType, ifArrayAccessExpr, ifArrayCreationExpr, ifArrayInitializerExpr, ifAssignExpr, ifBinaryExpr, ifBooleanLiteralExpr, ifCastExpr, ifCharLiteralExpr, ifClassExpr, ifConditionalExpr, ifDoubleLiteralExpr, ifEnclosedExpr, ifFieldAccessExpr, ifInstanceOfExpr, ifIntegerLiteralExpr, ifLambdaExpr, ifLiteralExpr, ifLiteralStringValueExpr, ifLongLiteralExpr, ifMarkerAnnotationExpr, ifMethodCallExpr, ifMethodReferenceExpr, ifNameExpr, ifNormalAnnotationExpr, ifNullLiteralExpr, ifObjectCreationExpr, ifSingleMemberAnnotationExpr, ifStringLiteralExpr, ifSuperExpr, ifSwitchExpr, ifThisExpr, ifTypeExpr, ifUnaryExpr, ifVariableDeclarationExpr, isArrayAccessExpr, isArrayCreationExpr, isArrayInitializerExpr, isAssignExpr, isBinaryExpr, isBooleanLiteralExpr, isCastExpr, isCharLiteralExpr, isClassExpr, isConditionalExpr, isDoubleLiteralExpr, isEnclosedExpr, isFieldAccessExpr, isInstanceOfExpr, isIntegerLiteralExpr, isLambdaExpr, isLiteralExpr, isLiteralStringValueExpr, isLongLiteralExpr, isMarkerAnnotationExpr, isMethodCallExpr, isMethodReferenceExpr, isNameExpr, isNormalAnnotationExpr, isNullLiteralExpr, isObjectCreationExpr, isSingleMemberAnnotationExpr, isStringLiteralExpr, isSuperExpr, isSwitchExpr, isThisExpr, isTypeExpr, isUnaryExpr, isVariableDeclarationExpr, toArrayAccessExpr, toArrayCreationExpr, toArrayInitializerExpr, toAssignExpr, toBinaryExpr, toBooleanLiteralExpr, toCastExpr, toCharLiteralExpr, toClassExpr, toConditionalExpr, toDoubleLiteralExpr, toEnclosedExpr, toFieldAccessExpr, toInstanceOfExpr, toIntegerLiteralExpr, toLambdaExpr, toLiteralExpr, toLiteralStringValueExpr, toLongLiteralExpr, toMarkerAnnotationExpr, toMethodCallExpr, toMethodReferenceExpr, toNameExpr, toNormalAnnotationExpr, toNullLiteralExpr, toObjectCreationExpr, toSingleMemberAnnotationExpr, toStringLiteralExpr, toSuperExpr, toSwitchExpr, toThisExpr, toTypeExpr, toUnaryExpr, toVariableDeclarationExpr
-
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, 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
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithName
getNameAsString, setName
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithRange
containsWithin, getBegin, getEnd
-
-
-
-
Field Detail
-
name
protected Name name
-
-
Constructor Detail
-
AnnotationExpr
public AnnotationExpr()
-
AnnotationExpr
public AnnotationExpr(Name name)
-
AnnotationExpr
public AnnotationExpr(TokenRange tokenRange, Name name)
This constructor is used by the parser and is considered private.
-
-
Method Detail
-
getName
public Name getName()
- Specified by:
getNamein interfaceNodeWithName<AnnotationExpr>
-
setName
public AnnotationExpr setName(Name name)
- Specified by:
setNamein interfaceNodeWithName<AnnotationExpr>
-
remove
public boolean remove(Node node)
- Overrides:
removein classExpression
-
clone
public AnnotationExpr clone()
- Overrides:
clonein classExpression
-
getMetaModel
public AnnotationExprMetaModel getMetaModel()
- Overrides:
getMetaModelin classExpression- Returns:
- get JavaParser specific node introspection information.
-
replace
public boolean replace(Node node, Node replacementNode)
- Overrides:
replacein classExpression
-
isAnnotationExpr
public boolean isAnnotationExpr()
- Overrides:
isAnnotationExprin classExpression
-
asAnnotationExpr
public AnnotationExpr asAnnotationExpr()
- Overrides:
asAnnotationExprin classExpression
-
ifAnnotationExpr
public void ifAnnotationExpr(Consumer<AnnotationExpr> action)
- Overrides:
ifAnnotationExprin classExpression
-
resolve
public ResolvedAnnotationDeclaration resolve()
Attempts to resolve the declaration corresponding to the annotation expression. If successful, aResolvedAnnotationDeclarationrepresenting the declaration of the annotation referenced by thisAnnotationExpris returned. Otherwise, anUnsolvedSymbolExceptionis thrown.- Specified by:
resolvein interfaceResolvable<ResolvedAnnotationDeclaration>- Returns:
- a
ResolvedAnnotationDeclarationrepresenting the declaration of the annotation expression. - Throws:
UnsolvedSymbolException- if the declaration corresponding to the annotation expression could not be resolved.
-
toAnnotationExpr
public Optional<AnnotationExpr> toAnnotationExpr()
- Overrides:
toAnnotationExprin classExpression
-
-