Package com.github.javaparser.ast.expr
Class VariableDeclarationExpr
- java.lang.Object
-
- com.github.javaparser.ast.Node
-
- com.github.javaparser.ast.expr.Expression
-
- com.github.javaparser.ast.expr.VariableDeclarationExpr
-
- All Implemented Interfaces:
NodeWithFinalModifier<VariableDeclarationExpr>,NodeWithAnnotations<VariableDeclarationExpr>,NodeWithModifiers<VariableDeclarationExpr>,NodeWithRange<Node>,NodeWithTokenRange<Node>,NodeWithVariables<VariableDeclarationExpr>,Observable,Visitable,HasParentNode<Node>,Cloneable
public final class VariableDeclarationExpr extends Expression implements NodeWithFinalModifier<VariableDeclarationExpr>, NodeWithAnnotations<VariableDeclarationExpr>, NodeWithVariables<VariableDeclarationExpr>
A declaration of variables. It is an expression, so it can be put in places like the initializer of a for loop, or the resources part of the try statement.final int x=3, y=55- Author:
- Julio Vilmar Gesser
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.github.javaparser.ast.Node
Node.ObserverRegistrationMode, Node.Parsedness
-
-
Field Summary
-
Fields inherited from class com.github.javaparser.ast.Node
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
-
-
Constructor Summary
Constructors Constructor Description VariableDeclarationExpr()VariableDeclarationExpr(VariableDeclarator var)VariableDeclarationExpr(VariableDeclarator var, Modifier... modifiers)VariableDeclarationExpr(NodeList<VariableDeclarator> variables)VariableDeclarationExpr(Type type, String variableName)VariableDeclarationExpr(Type type, String variableName, Modifier... modifiers)VariableDeclarationExpr(TokenRange tokenRange, EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<VariableDeclarator> variables)This constructor is used by the parser and is considered private.VariableDeclarationExpr(EnumSet<Modifier> modifiers, NodeList<VariableDeclarator> variables)VariableDeclarationExpr(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<VariableDeclarator> variables)
-
Method Summary
All Methods Instance Methods Concrete 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.VariableDeclarationExprclone()NodeList<AnnotationExpr>getAnnotations()VariableDeclarationExprMetaModelgetMetaModel()EnumSet<Modifier>getModifiers()Return the modifiers of this variable declaration.List<NodeList<?>>getNodeLists()The list of NodeLists owned by this node.NodeList<VariableDeclarator>getVariables()booleanremove(Node node)booleanreplace(Node node, Node replacementNode)VariableDeclarationExprsetAnnotations(NodeList<AnnotationExpr> annotations)VariableDeclarationExprsetModifiers(EnumSet<Modifier> modifiers)VariableDeclarationExprsetVariables(NodeList<VariableDeclarator> variables)-
Methods inherited from class com.github.javaparser.ast.Node
addOrphanComment, customInitialization, equals, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getTokenRange, hasComment, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, toString, toString, tryAddImportToParentCompilationUnit, unregister
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.HasParentNode
getAncestorOfType
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithAnnotations
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnit
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.modifiers.NodeWithFinalModifier
isFinal, setFinal
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithModifiers
addModifier, removeModifier, setModifier
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithRange
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithVariables
addVariable, getCommonType, getElementType, getMaximumCommonType, getVariable, setVariable
-
-
-
-
Constructor Detail
-
VariableDeclarationExpr
public VariableDeclarationExpr()
-
VariableDeclarationExpr
public VariableDeclarationExpr(VariableDeclarator var)
-
VariableDeclarationExpr
public VariableDeclarationExpr(Type type, String variableName, Modifier... modifiers)
-
VariableDeclarationExpr
public VariableDeclarationExpr(VariableDeclarator var, Modifier... modifiers)
-
VariableDeclarationExpr
public VariableDeclarationExpr(NodeList<VariableDeclarator> variables)
-
VariableDeclarationExpr
public VariableDeclarationExpr(EnumSet<Modifier> modifiers, NodeList<VariableDeclarator> variables)
-
VariableDeclarationExpr
public VariableDeclarationExpr(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<VariableDeclarator> variables)
-
VariableDeclarationExpr
@Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") public VariableDeclarationExpr(TokenRange tokenRange, EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<VariableDeclarator> variables)
This constructor is used by the parser and is considered private.
-
-
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.
-
getAnnotations
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public NodeList<AnnotationExpr> getAnnotations()
- Specified by:
getAnnotationsin interfaceNodeWithAnnotations<VariableDeclarationExpr>
-
getModifiers
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public EnumSet<Modifier> getModifiers()
Return the modifiers of this variable declaration.- Specified by:
getModifiersin interfaceNodeWithModifiers<VariableDeclarationExpr>- Returns:
- modifiers
- See Also:
Modifier
-
getVariables
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public NodeList<VariableDeclarator> getVariables()
- Specified by:
getVariablesin interfaceNodeWithVariables<VariableDeclarationExpr>
-
setAnnotations
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public VariableDeclarationExpr setAnnotations(NodeList<AnnotationExpr> annotations)
- Specified by:
setAnnotationsin interfaceNodeWithAnnotations<VariableDeclarationExpr>
-
setModifiers
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public VariableDeclarationExpr setModifiers(EnumSet<Modifier> modifiers)
- Specified by:
setModifiersin interfaceNodeWithModifiers<VariableDeclarationExpr>
-
setVariables
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public VariableDeclarationExpr setVariables(NodeList<VariableDeclarator> variables)
- Specified by:
setVariablesin interfaceNodeWithVariables<VariableDeclarationExpr>
-
getNodeLists
@Generated("com.github.javaparser.generator.core.node.GetNodeListsGenerator") public List<NodeList<?>> getNodeLists()
Description copied from class:NodeThe list of NodeLists owned by this node.- Overrides:
getNodeListsin classNode
-
remove
@Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
- Overrides:
removein classExpression
-
clone
@Generated("com.github.javaparser.generator.core.node.CloneGenerator") public VariableDeclarationExpr clone()
- Overrides:
clonein classExpression
-
getMetaModel
@Generated("com.github.javaparser.generator.core.node.GetMetaModelGenerator") public VariableDeclarationExprMetaModel getMetaModel()
- Overrides:
getMetaModelin classExpression- Returns:
- get JavaParser specific node introspection information.
-
replace
@Generated("com.github.javaparser.generator.core.node.ReplaceMethodGenerator") public boolean replace(Node node, Node replacementNode)
- Overrides:
replacein classExpression
-
-