public class ThrowsTypeTarget extends PositionBasedTypeTarget
throws clause of an enclosing method.
This class conveys the enclosing method and the zero-based position of the throwable type.
The corresponding type reference is also included.
Consider the following example involving a type target using the Bar annotation:
public void foo(List<T> l) throws @Bar FooException { ... }
This example would be represented as a ThrowsTypeTarget with an enclosing target
of the MethodInfo of foo, and position() would be 0.
TypeTarget.UsageAnnotationTarget.Kind| Modifier and Type | Method and Description |
|---|---|
ThrowsTypeTarget |
asThrows()
Casts and returns this type target as a
ThrowsTypeTarget. |
MethodInfo |
enclosingTarget()
Returns the enclosing target that contains the type referred to by the
TypeTarget.target() method. |
TypeTarget.Usage |
usage()
Returns the kind of usage of this type target.
|
positionannotation, annotations, annotations, annotationsWithRepeatable, asClass, asClassExtends, asEmpty, asField, asMethod, asMethodParameter, asMethodParameterType, asRecordComponent, asType, asTypeParameter, asTypeParameterBound, declaredAnnotation, declaredAnnotations, declaredAnnotationsWithRepeatable, hasAnnotation, hasDeclaredAnnotation, kind, targetclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitannotation, annotation, annotations, annotations, annotationsWithRepeatable, annotationsWithRepeatable, declaredAnnotation, declaredAnnotation, declaredAnnotationsWithRepeatable, declaredAnnotationsWithRepeatable, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotationpublic TypeTarget.Usage usage()
TypeTargetgetClass() comparisons.usage in class TypeTargetpublic MethodInfo enclosingTarget()
TypeTargetTypeTarget.target() method.enclosingTarget in class TypeTargetpublic ThrowsTypeTarget asThrows()
TypeTargetThrowsTypeTarget. If this type target
is not a ThrowsTypeTarget, then an exception will be thrown.asThrows in class TypeTargetThrowsTypeTargetCopyright © 2018–2022. All rights reserved.