public final class IfStmt extends Statement implements NodeWithCondition<IfStmt>
if(a==5) hurray() else boo();
the condition is a==5,
hurray() is the thenStmt, and boo() is the elseStmt.Node.ObserverRegistrationMode, Node.Parsedness
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
Constructor and Description |
---|
IfStmt() |
IfStmt(Expression condition,
Statement thenStmt,
Statement elseStmt) |
IfStmt(TokenRange tokenRange,
Expression condition,
Statement thenStmt,
Statement elseStmt)
This constructor is used by the parser and is considered private.
|
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.
|
IfStmt |
clone() |
Expression |
getCondition() |
Optional<Statement> |
getElseStmt() |
IfStmtMetaModel |
getMetaModel() |
Statement |
getThenStmt() |
boolean |
hasElseBlock() |
boolean |
hasThenBlock() |
boolean |
remove(Node node) |
IfStmt |
removeElseStmt() |
boolean |
replace(Node node,
Node replacementNode) |
IfStmt |
setCondition(Expression condition) |
IfStmt |
setElseStmt(Statement elseStmt)
Sets the elseStmt
|
IfStmt |
setThenStmt(Statement thenStmt) |
addOrphanComment, customInitialization, equals, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodeLists, 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
finalize, getClass, notify, notifyAll, wait, wait, wait
getAncestorOfType
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
public IfStmt()
public IfStmt(Expression condition, Statement thenStmt, Statement elseStmt)
@Generated(value="com.github.javaparser.generator.core.node.MainConstructorGenerator") public IfStmt(TokenRange tokenRange, Expression condition, Statement thenStmt, Statement elseStmt)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitable
accept
in interface Visitable
R
- 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)
Visitable
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public Expression getCondition()
getCondition
in interface NodeWithCondition<IfStmt>
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public Optional<Statement> getElseStmt()
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public Statement getThenStmt()
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public IfStmt setCondition(Expression condition)
setCondition
in interface NodeWithCondition<IfStmt>
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public IfStmt setElseStmt(Statement elseStmt)
elseStmt
- the elseStmt, can be null@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public IfStmt setThenStmt(Statement thenStmt)
@Generated(value="com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
@Generated(value="com.github.javaparser.generator.core.node.RemoveMethodGenerator") public IfStmt removeElseStmt()
public boolean hasThenBlock()
public boolean hasElseBlock()
@Generated(value="com.github.javaparser.generator.core.node.CloneGenerator") public IfStmt clone()
@Generated(value="com.github.javaparser.generator.core.node.GetMetaModelGenerator") public IfStmtMetaModel getMetaModel()
getMetaModel
in class Statement
Copyright © 2007–2017. All rights reserved.