Interface JTryStatement

  • All Superinterfaces:
    JStatement
    All Known Implementing Classes:
    JTryStatementImpl

    public interface JTryStatement
    extends JStatement
    Supports all possible variations of try-catch-finally statement.
    • Method Detail

      • addCatch

        JCompoundStatement addCatch​(java.lang.Class<? extends java.lang.Throwable> t,
                                    java.lang.String varName)
        Adds a catch clause for the specified Throwable.

        Adding the same Throwable twice causes an exception.

        Parameters:
        t - Throwable class
        varName - name of Throwable variable to declare
      • catchVariable

        JLocalVariable catchVariable​(java.lang.Class<? extends java.lang.Throwable> t)
        Returns a throwable variable of the specificed catch clause

        Throws an exception if addCatch was not called for the specified t.

        Parameters:
        t - Throwable class
      • addFinally

        JCompoundStatement addFinally()
        Adds a finally clause.

        Calling of the method twice causes an exception.