Class ImplJCatch

All Implemented Interfaces:
BlockContent, JBlock, JCatch, JCommentable, JStatement, JTry, Writable

class ImplJCatch extends BasicJBlock implements JCatch
  • Field Details

    • _try

      private final ImplJTry _try
    • mods

      private final int mods
    • var

      private final String var
    • types

      private final ArrayList<JType> types
  • Constructor Details

  • Method Details

    • or

      public JCatch or(JType orType)
      Description copied from interface: JCatch
      Add another type option to this catch branch.
      Specified by:
      or in interface JCatch
      Parameters:
      orType - the alternative type
      Returns:
      this catch block
    • or

      public JCatch or(String orType)
      Description copied from interface: JCatch
      Add another type option to this catch branch.
      Specified by:
      or in interface JCatch
      Parameters:
      orType - the alternative type
      Returns:
      this catch block
    • or

      public JCatch or(Class<? extends Throwable> orType)
      Description copied from interface: JCatch
      Add another type option to this catch branch.
      Specified by:
      or in interface JCatch
      Parameters:
      orType - the alternative type
      Returns:
      this catch block
    • with

      public JVarDeclaration with(int mods, String type, 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, 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, Class<? extends AutoCloseable> type, 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, String type, 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, Class<? extends Throwable> type, 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, 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
    • ignore

      public JTry ignore(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(Class<? extends 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
    • getTry

      ImplJTry getTry()
    • getTypes

      ArrayList<JType> getTypes()
    • getMods

      int getMods()
    • getVar

      String getVar()
    • write

      public void write(SourceFileWriter writer) throws IOException
      Specified by:
      write in interface Writable
      Overrides:
      write in class BasicJBlock
      Throws:
      IOException