public final class VariableDeclarator extends Node implements NodeWithType<VariableDeclarator,Type<?>>
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION
Constructor and Description |
---|
VariableDeclarator() |
VariableDeclarator(Range range,
VariableDeclaratorId id,
Optional<Expression> init) |
VariableDeclarator(String variableName) |
VariableDeclarator(String variableName,
Optional<Expression> init) |
VariableDeclarator(VariableDeclaratorId id) |
VariableDeclarator(VariableDeclaratorId id,
Optional<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() |
Optional<Expression> |
getInit() |
Type |
getType()
Gets the type
|
VariableDeclarator |
setId(VariableDeclaratorId id) |
VariableDeclarator |
setInit(Optional<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, getBackwardsCompatibleChildrenNodes, getBegin, getChildrenNodes, getComment, getEnd, getNodesByType, getOrphanComments, getParentNode, getParentNodeOfType, getRange, getUserData, hashCode, isPositionedAfter, isPositionedBefore, remove, setAsParentNodeOf, setAsParentNodeOf, setAsParentNodeOf, setBegin, setBlockComment, setComment, setEnd, setLineComment, setParentNode, setRange, setUserData, toString, toStringWithoutComments, tryAddImportToParentCompilationUnit
finalize, getClass, notify, notifyAll, wait, wait, wait
setType, setType
public VariableDeclarator()
public VariableDeclarator(VariableDeclaratorId id)
public VariableDeclarator(String variableName)
public VariableDeclarator(VariableDeclaratorId id, Optional<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, Optional<Expression> init)
public VariableDeclarator(Range range, VariableDeclaratorId id, Optional<Expression> init)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Node
public <A> void accept(VoidVisitor<A> v, A arg)
Node
public VariableDeclaratorId getId()
public Optional<Expression> getInit()
public VariableDeclarator setId(VariableDeclaratorId id)
public VariableDeclarator setInit(Optional<Expression> init)
public VariableDeclarator setInit(String init)
NameExpr
with the init parampublic Type getType()
NodeWithType
getType
in interface NodeWithType<VariableDeclarator,Type<?>>
public VariableDeclarator setType(Type type)
NodeWithType
setType
in interface NodeWithType<VariableDeclarator,Type<?>>
type
- the typeCopyright © 2007–2016. All rights reserved.