Class ImplJTry

    • Method Detail

      • with

        public JVarDeclaration with​(int mods,
                                    java.lang.String type,
                                    java.lang.String var,
                                    JExpr init)
        Description copied from interface: JTry
        Add a resource for try-with-resources constructs.
        Specified by:
        with in interface JTry
        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

        public JVarDeclaration with​(int mods,
                                    JType type,
                                    java.lang.String var,
                                    JExpr init)
        Description copied from interface: JTry
        Add a resource for try-with-resources constructs.
        Specified by:
        with in interface JTry
        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

        public JVarDeclaration with​(int mods,
                                    java.lang.Class<? extends java.lang.AutoCloseable> type,
                                    java.lang.String var,
                                    JExpr init)
        Description copied from interface: JTry
        Add a resource for try-with-resources constructs.
        Specified by:
        with in interface JTry
        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

        public JCatch _catch​(int mods,
                             java.lang.String type,
                             java.lang.String var)
        Description copied from interface: JTry
        Add a catch block.
        Specified by:
        _catch in interface JTry
        Parameters:
        mods - the catch block modifiers
        type - the exception type
        var - the exception variable name
        Returns:
        the catch sub-block
      • _catch

        public JCatch _catch​(int mods,
                             java.lang.Class<? extends java.lang.Throwable> type,
                             java.lang.String var)
        Description copied from interface: JTry
        Add a catch block.
        Specified by:
        _catch in interface JTry
        Parameters:
        mods - the catch block modifiers
        type - the exception type
        var - the exception variable name
        Returns:
        the catch sub-block
      • _catch

        public JCatch _catch​(int mods,
                             JType type,
                             java.lang.String var)
        Description copied from interface: JTry
        Add a catch block.
        Specified by:
        _catch in interface JTry
        Parameters:
        mods - the catch block modifiers
        type - the exception type
        var - the exception variable name
        Returns:
        the catch sub-block
      • add

        private <T extends ImplJCatch> T add​(T item)
      • ignore

        public JTry ignore​(java.lang.String type)
        Description copied from interface: JTry
        Add a catch for an ignored exception.
        Specified by:
        ignore in interface JTry
        Parameters:
        type - the exception type
        Returns:
        this try block
      • ignore

        public JTry ignore​(java.lang.Class<? extends java.lang.Throwable> type)
        Description copied from interface: JTry
        Add a catch for an ignored exception.
        Specified by:
        ignore in interface JTry
        Parameters:
        type - the exception type
        Returns:
        this try block
      • ignore

        public JTry ignore​(JType type)
        Description copied from interface: JTry
        Add a catch for an ignored exception.
        Specified by:
        ignore in interface JTry
        Parameters:
        type - the exception type
        Returns:
        this try block
      • _finally

        public JBlock _finally()
        Description copied from interface: JTry
        Add the finally block for this try.
        Specified by:
        _finally in interface JTry
        Returns:
        the finally sub-block