Class CatchClause

java.lang.Object
com.github.javaparser.ast.Node
com.github.javaparser.ast.stmt.CatchClause
All Implemented Interfaces:
NodeWithBlockStmt<CatchClause>, NodeWithRange<Node>, NodeWithTokenRange<Node>, Observable, Visitable, HasParentNode<Node>, Cloneable

public class CatchClause extends Node implements NodeWithBlockStmt<CatchClause>
The catch part of a try-catch-finally.
In try { ... } catch (Exception e) { ... } the CatchClause is catch (Exception e) { ... }. Exception e is the parameter. The { ... } is the body.
Author:
Julio Vilmar Gesser
  • Constructor Details

  • Method Details

    • accept

      public <R,​ A> R accept(GenericVisitor<R,​A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Specified by:
      accept in interface Visitable
      Type Parameters:
      R - the type of the return value of the visitor
      A - the type the user argument passed to the visitor
      Parameters:
      v - the visitor implementation
      arg - the argument passed to the visitor (of type A)
      Returns:
      the result of the visit (of type R)
    • accept

      public <A> void accept(VoidVisitor<A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Specified by:
      accept in interface Visitable
      Type Parameters:
      A - the type the argument passed for the visitor
      Parameters:
      v - the visitor implementation
      arg - any value relevant for the visitor (of type A)
    • getParameter

      public Parameter getParameter()
      Note that the type of the Parameter can be a UnionType. In this case, any annotations found at the start of the catch(@X A a |...) are found directly in the Parameter. Annotations that are on the second or later type - catch(A a | @X B b ...) are found on those types.
    • setParameter

      public CatchClause setParameter(Parameter parameter)
    • getBody

      public BlockStmt getBody()
      Specified by:
      getBody in interface NodeWithBlockStmt<CatchClause>
    • setBody

      public CatchClause setBody(BlockStmt body)
      Specified by:
      setBody in interface NodeWithBlockStmt<CatchClause>
    • clone

      public CatchClause clone()
      Overrides:
      clone in class Node
    • getMetaModel

      public CatchClauseMetaModel getMetaModel()
      Overrides:
      getMetaModel in class Node
      Returns:
      get JavaParser specific node introspection information.
    • replace

      public boolean replace(Node node, Node replacementNode)
      Overrides:
      replace in class Node