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

public Interface InstanceOfTree

extends ExpressionTree
Known Direct Implementers
com.sun.tools.javac.tree.JCTree.JCInstanceOf

A tree node for an instanceof expression. For example:
  expression instanceof type

  expression instanceof pattern
Authors
Peter von der Ahé, Jonathan Gibbons
Since
1.6
Java Language Specification
15.20.2 The instanceof Operator

Method Summary

Modifier and TypeMethod and Description
public ExpressionTree

Returns:

the expression
getExpression
()

Returns the expression to be tested.

public PatternTree

Returns:

the tested pattern, or null if this instanceof does not use a pattern
getPattern
()

Returns the tested pattern, or null if this instanceof does not use a pattern.

public Tree

Returns:

the type or null if this instanceof uses a pattern other than the BindingPatternTree
getType
()

Returns the type for which to check, or null if this instanceof uses a pattern other the BindingPatternTree.

Method Detail

getExpressionback to summary
public ExpressionTree getExpression()

Returns the expression to be tested.

Returns:ExpressionTree

the expression

getPatternback to summary
public PatternTree getPattern()

Returns the tested pattern, or null if this instanceof does not use a pattern.

For instanceof with a pattern, i.e. in the following form:

  expression instanceof pattern
returns the pattern.

For instanceof without a pattern, i.e. in the following form:

  expression instanceof type
returns null.
Returns:PatternTree

the tested pattern, or null if this instanceof does not use a pattern

Since
16
getTypeback to summary
public Tree getType()

Returns the type for which to check, or null if this instanceof uses a pattern other the BindingPatternTree.

For instanceof without a pattern, i.e. in the following form:

  expression instanceof type
returns the type.

For instanceof with a BindingPatternTree, i.e. in the following form:

  expression instanceof type variable_name
returns the type.

For instanceof with a pattern, i.e. in the following form:

  expression instanceof pattern
returns null.
Returns:Tree

the type or null if this instanceof uses a pattern other than the BindingPatternTree

See Also
getPattern()