public interface

IJavaTry

implements IJavaCompound
com.pnfsoftware.jeb.core.units.code.java.IJavaTry

Class Overview

Java AST interface to represent try-catch elements.

See Also

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
Public Methods
abstract void addCatchBlock(IJavaType type, List<IJavaType> addTypes, IJavaIdentifier ident, IJavaDefinition def, IJavaBlock block)
abstract void addCatchBlock(int index, IJavaType type, List<IJavaType> addTypes, IJavaIdentifier ident, IJavaDefinition def, IJavaBlock block)
abstract void addResourceAcq(int i, IJavaExpression exp)
abstract void addResourceAcq(IJavaExpression exp)
abstract IJavaTry duplicate()
Duplicate this element.
abstract IJavaCatchBlock getCatchBlock(int index)
abstract IJavaBlock getCatchBody(int index)
Get a catch body.
abstract int getCatchByType(String typestring)
abstract int getCatchCount()
Get the number of catch blocks.
abstract IJavaIdentifier getCatchIdentifier(int index)
Get the named identifier associated with the caught exception of a catch block.
abstract IJavaType getCatchType(int index)
Get the type of exception caught by a catch block.
abstract IJavaBlock getFinallyBlock()
Get the finally block, if there is one.
abstract IJavaBlock getFinallyBody()
This method is deprecated. use getFinallyBlock()
abstract List<IJavaExpression> getResourceAcqs()
abstract IJavaBlock getTryBody()
Get the try block.
abstract boolean hasFinallyBlock()
abstract boolean isTryWithResource()
abstract IJavaCatchBlock removeCatchBlock(int index)
abstract void removeResourceAcq(int i)
abstract void setFinallyBlock(IJavaBlock blk)
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaCompound
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaExpression
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaStatement

Public Methods

public abstract void addCatchBlock (IJavaType type, List<IJavaType> addTypes, IJavaIdentifier ident, IJavaDefinition def, IJavaBlock block)

public abstract void addCatchBlock (int index, IJavaType type, List<IJavaType> addTypes, IJavaIdentifier ident, IJavaDefinition def, IJavaBlock block)

public abstract void addResourceAcq (int i, IJavaExpression exp)

Parameters
i insertion index
exp an acquisition expression that will be added to the current list of acquisition expressions

public abstract void addResourceAcq (IJavaExpression exp)

Parameters
exp an acquisition expression that will be appended to the current list of acquisition expressions

public abstract IJavaTry duplicate ()

Duplicate this element.

Returns
  • a (possibly) duplicated object of the same type

public abstract IJavaCatchBlock getCatchBlock (int index)

public abstract IJavaBlock getCatchBody (int index)

Get a catch body.

Parameters
index 0-based catch block index
Returns
  • the catch body

public abstract int getCatchByType (String typestring)

public abstract int getCatchCount ()

Get the number of catch blocks.

Returns
  • the number of catch blocks.

public abstract IJavaIdentifier getCatchIdentifier (int index)

Get the named identifier associated with the caught exception of a catch block.

Parameters
index 0-based catch block index
Returns
  • the caught exception identifier, may be null if there is none

public abstract IJavaType getCatchType (int index)

Get the type of exception caught by a catch block.

Parameters
index 0-based catch block index
Returns
  • the caught exception type

public abstract IJavaBlock getFinallyBlock ()

Get the finally block, if there is one.

Returns
  • the finally block, null if there is none

public abstract IJavaBlock getFinallyBody ()

This method is deprecated.
use getFinallyBlock()

public abstract List<IJavaExpression> getResourceAcqs ()

Returns
  • a read-only list of acquisition expressions

public abstract IJavaBlock getTryBody ()

Get the try block.

Returns
  • the try block, never null

public abstract boolean hasFinallyBlock ()

public abstract boolean isTryWithResource ()

Returns
  • true if this try-statement is a try-with-resource (a try with resource-acquisition expressions)

public abstract IJavaCatchBlock removeCatchBlock (int index)

public abstract void removeResourceAcq (int i)

Parameters
i acquisition expression index

public abstract void setFinallyBlock (IJavaBlock blk)