Interface NodeWithThrownExceptions<N extends Node>
- All Known Implementing Classes:
CallableDeclaration,CompactConstructorDeclaration,ConstructorDeclaration,MethodDeclaration
public interface NodeWithThrownExceptions<N extends Node>
A node that declares the types of exception it throws.
-
Method Summary
Modifier and TypeMethodDescriptiondefault NaddThrownException(ReferenceType throwType) Adds this type to the throws clausedefault NaddThrownException(Class<? extends Throwable> clazz) Adds this class to the throws clausedefault ReferenceTypegetThrownException(int i) default booleanCheck whether this elements throws this exception class.default booleanCheck whether this elements throws this exception class Note that this is simply a text compare, no actual type resolution takes place.setThrownExceptions(NodeList<ReferenceType> thrownExceptions) voidtryAddImportToParentCompilationUnit(Class<?> clazz)
-
Method Details
-
setThrownExceptions
-
getThrownExceptions
NodeList<ReferenceType> getThrownExceptions() -
tryAddImportToParentCompilationUnit
-
getThrownException
-
addThrownException
Adds this type to the throws clause- Parameters:
throwType- the exception type- Returns:
- this
-
addThrownException
Adds this class to the throws clause- Parameters:
clazz- the exception class- Returns:
- this
-
isThrown
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
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
-