APIdia Launch Partner
Top Description Methods
com.sun.source.tree

public Interface IfTree

extends StatementTree
Known Direct Implementers
com.sun.tools.javac.tree.JCTree.JCIf

A tree node for an if statement. For example:
  if ( condition )
     thenStatement

  if ( condition )
      thenStatement
  else
      elseStatement
Authors
Peter von der Ahé, Jonathan Gibbons
Since
1.6
Java Language Specification
14.9 The if Statement

Method Summary

Modifier and TypeMethod and Description
public ExpressionTree

Returns:

the condition
getCondition
()

Returns the condition of the if-statement.

public StatementTree

Returns:

the statement to be executed if the condition is false
getElseStatement
()

Returns the statement to be executed if the condition is false, or null if there is no such statement.

public StatementTree

Returns:

the statement to be executed if the condition is true
getThenStatement
()

Returns the statement to be executed if the condition is true

Method Detail

getConditionback to summary
public ExpressionTree getCondition()

Returns the condition of the if-statement.

Returns:ExpressionTree

the condition

getElseStatementback to summary
public StatementTree getElseStatement()

Returns the statement to be executed if the condition is false, or null if there is no such statement.

Returns:StatementTree

the statement to be executed if the condition is false

getThenStatementback to summary
public StatementTree getThenStatement()

Returns the statement to be executed if the condition is true

Returns:StatementTree

the statement to be executed if the condition is true