Interface JTry

    • Method Detail

      • with

        JVarDeclaration with​(int mods,
                             java.lang.String type,
                             java.lang.String var,
                             JExpr init)
        Add a resource for try-with-resources constructs.
        Parameters:
        mods - the resource variable modifiers
        type - the resource variable type
        var - the resource variable name
        init - the resource variable initialization value
        Returns:
        the variable declaration
      • with

        JVarDeclaration with​(int mods,
                             JType type,
                             java.lang.String var,
                             JExpr init)
        Add a resource for try-with-resources constructs.
        Parameters:
        mods - the resource variable modifiers
        type - the resource variable type
        var - the resource variable name
        init - the resource variable initialization value
        Returns:
        the variable declaration
      • with

        JVarDeclaration with​(int mods,
                             java.lang.Class<? extends java.lang.AutoCloseable> type,
                             java.lang.String var,
                             JExpr init)
        Add a resource for try-with-resources constructs.
        Parameters:
        mods - the resource variable modifiers
        type - the resource variable type
        var - the resource variable name
        init - the resource variable initialization value
        Returns:
        the variable declaration
      • _catch

        JCatch _catch​(int mods,
                      java.lang.String type,
                      java.lang.String var)
        Add a catch block.
        Parameters:
        mods - the catch block modifiers
        type - the exception type
        var - the exception variable name
        Returns:
        the catch sub-block
      • _catch

        JCatch _catch​(int mods,
                      java.lang.Class<? extends java.lang.Throwable> type,
                      java.lang.String var)
        Add a catch block.
        Parameters:
        mods - the catch block modifiers
        type - the exception type
        var - the exception variable name
        Returns:
        the catch sub-block
      • _catch

        JCatch _catch​(int mods,
                      JType type,
                      java.lang.String var)
        Add a catch block.
        Parameters:
        mods - the catch block modifiers
        type - the exception type
        var - the exception variable name
        Returns:
        the catch sub-block
      • ignore

        JTry ignore​(java.lang.String type)
        Add a catch for an ignored exception.
        Parameters:
        type - the exception type
        Returns:
        this try block
      • ignore

        JTry ignore​(java.lang.Class<? extends java.lang.Throwable> type)
        Add a catch for an ignored exception.
        Parameters:
        type - the exception type
        Returns:
        this try block
      • ignore

        JTry ignore​(JType type)
        Add a catch for an ignored exception.
        Parameters:
        type - the exception type
        Returns:
        this try block
      • _finally

        JBlock _finally()
        Add the finally block for this try.
        Returns:
        the finally sub-block