Interface NodeWithThrownExceptions<N extends Node>
-
- All Known Implementing Classes:
CallableDeclaration
,ConstructorDeclaration
,MethodDeclaration
public interface NodeWithThrownExceptions<N extends Node>
A node that declares the types of exception it throws.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default N
addThrownException(ReferenceType throwType)
Adds this type to the throws clausedefault N
addThrownException(Class<? extends Throwable> clazz)
Adds this class to the throws clausedefault ReferenceType
getThrownException(int i)
NodeList<ReferenceType>
getThrownExceptions()
default boolean
isThrown(Class<? extends Throwable> clazz)
Check whether this elements throws this exception class.default boolean
isThrown(String throwableName)
Check whether this elements throws this exception class Note that this is simply a text compare, no actual type resolution takes place.N
setThrownExceptions(NodeList<ReferenceType> thrownExceptions)
void
tryAddImportToParentCompilationUnit(Class<?> clazz)
-
-
-
Method Detail
-
setThrownExceptions
N setThrownExceptions(NodeList<ReferenceType> thrownExceptions)
-
getThrownExceptions
NodeList<ReferenceType> getThrownExceptions()
-
tryAddImportToParentCompilationUnit
void tryAddImportToParentCompilationUnit(Class<?> clazz)
-
getThrownException
default ReferenceType getThrownException(int i)
-
addThrownException
default N addThrownException(ReferenceType throwType)
Adds this type to the throws clause- Parameters:
throwType
- the exception type- Returns:
- this
-
addThrownException
default N addThrownException(Class<? extends Throwable> clazz)
Adds this class to the throws clause- Parameters:
clazz
- the exception class- Returns:
- this
-
isThrown
default boolean isThrown(Class<? extends Throwable> clazz)
Check whether this elements throws this exception class. Note that this is simply a text compare of the simple name of the class, no actual type resolution takes place.- Parameters:
clazz
- the class of the exception- Returns:
- true if found in throws clause, false if not
-
isThrown
default boolean isThrown(String throwableName)
Check whether this elements throws this exception class Note that this is simply a text compare, no actual type resolution takes place.- Parameters:
throwableName
- the class of the exception- Returns:
- true if found in throws clause, false if not
-
-