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, SYMBOL_RESOLVER_KEY
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 |
asIfStmt() |
IfStmt |
clone() |
Expression |
getCondition() |
Optional<Statement> |
getElseStmt() |
IfStmtMetaModel |
getMetaModel() |
Statement |
getThenStmt() |
boolean |
hasElseBlock() |
boolean |
hasThenBlock() |
void |
ifIfStmt(Consumer<IfStmt> action) |
boolean |
isIfStmt() |
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) |
asAssertStmt, asBlockStmt, asBreakStmt, asContinueStmt, asDoStmt, asEmptyStmt, asExplicitConstructorInvocationStmt, asExpressionStmt, asForeachStmt, asForStmt, asLabeledStmt, asLocalClassDeclarationStmt, asReturnStmt, asSwitchEntryStmt, asSwitchStmt, asSynchronizedStmt, asThrowStmt, asTryStmt, asUnparsableStmt, asWhileStmt, ifAssertStmt, ifBlockStmt, ifBreakStmt, ifContinueStmt, ifDoStmt, ifEmptyStmt, ifExplicitConstructorInvocationStmt, ifExpressionStmt, ifForeachStmt, ifForStmt, ifLabeledStmt, ifLocalClassDeclarationStmt, ifReturnStmt, ifSwitchEntryStmt, ifSwitchStmt, ifSynchronizedStmt, ifThrowStmt, ifTryStmt, ifUnparsableStmt, ifWhileStmt, isAssertStmt, isBlockStmt, isBreakStmt, isContinueStmt, isDoStmt, isEmptyStmt, isExplicitConstructorInvocationStmt, isExpressionStmt, isForeachStmt, isForStmt, isLabeledStmt, isLocalClassDeclarationStmt, isReturnStmt, isSwitchEntryStmt, isSwitchStmt, isSynchronizedStmt, isThrowStmt, isTryStmt, isUnparsableStmt, isWhileStmt
addOrphanComment, containsData, customInitialization, equals, findCompilationUnit, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getSymbolResolver, 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
@Generated(value="com.github.javaparser.generator.core.node.ReplaceMethodGenerator") public boolean replace(Node node, Node replacementNode)
@Generated(value="com.github.javaparser.generator.core.node.TypeCastingGenerator") public boolean isIfStmt()
@Generated(value="com.github.javaparser.generator.core.node.TypeCastingGenerator") public IfStmt asIfStmt()
Copyright © 2007–2017. All rights reserved.