public final class VariableDeclarator extends Node implements NodeWithType<VariableDeclarator,Type<?>>
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration| Constructor and Description |
|---|
VariableDeclarator() |
VariableDeclarator(Range range,
VariableDeclaratorId id,
Expression init) |
VariableDeclarator(String variableName) |
VariableDeclarator(String variableName,
Expression init) |
VariableDeclarator(VariableDeclaratorId id) |
VariableDeclarator(VariableDeclaratorId id,
Expression init)
Defines the declaration of a variable.
|
| Modifier and Type | Method and Description |
|---|---|
<R,A> R |
accept(GenericVisitor<R,A> v,
A arg)
Accept method for visitor support.
|
<A> void |
accept(VoidVisitor<A> v,
A arg)
Accept method for visitor support.
|
VariableDeclaratorId |
getId() |
Expression |
getInit() |
Type |
getType()
Gets the type
|
VariableDeclarator |
setId(VariableDeclaratorId id) |
VariableDeclarator |
setInit(Expression init) |
VariableDeclarator |
setInit(String init)
Will create a
NameExpr with the init param |
VariableDeclarator |
setType(Type type)
Sets the type
|
addOrphanComment, clone, containsWithin, equals, getAllContainedComments, getBegin, getChildNodes, getComment, getEnd, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getRange, getUserData, hasComment, hashCode, isPositionedAfter, isPositionedBefore, remove, setAsParentNodeOf, setBegin, setBlockComment, setComment, setEnd, setLineComment, setParentNode, setRange, setUserData, toString, toString, tryAddImportToParentCompilationUnitfinalize, getClass, notify, notifyAll, wait, wait, waitsetType, setTypegetAncestorOfType, setAsParentNodeOf, setAsParentNodeOfpublic VariableDeclarator()
public VariableDeclarator(VariableDeclaratorId id)
public VariableDeclarator(String variableName)
public VariableDeclarator(VariableDeclaratorId id, Expression init)
id - The identifier for this variable. IE. The variables name.init - What this variable should be initialized to.
An AssignExpr is unnecessary as the = operator is
already added.public VariableDeclarator(String variableName, Expression init)
public VariableDeclarator(Range range, VariableDeclaratorId id, Expression init)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitableaccept in interface VisitableR - the type of the return value of the visitorA - the type the user argument passed to the visitorv - the visitor implementationarg - the argument passed to the visitor (of type A)public <A> void accept(VoidVisitor<A> v, A arg)
Visitablepublic VariableDeclaratorId getId()
public Expression getInit()
public VariableDeclarator setId(VariableDeclaratorId id)
public VariableDeclarator setInit(Expression init)
public VariableDeclarator setInit(String init)
NameExpr with the init parampublic Type getType()
NodeWithTypegetType in interface NodeWithType<VariableDeclarator,Type<?>>public VariableDeclarator setType(Type type)
NodeWithTypesetType in interface NodeWithType<VariableDeclarator,Type<?>>type - the typeCopyright © 2007–2016. All rights reserved.