Package org.jboss.jandex
Class ThrowsTypeTarget
- java.lang.Object
-
- org.jboss.jandex.TypeTarget
-
- org.jboss.jandex.PositionBasedTypeTarget
-
- org.jboss.jandex.ThrowsTypeTarget
-
- All Implemented Interfaces:
AnnotationTarget
public class ThrowsTypeTarget extends PositionBasedTypeTarget
Represents a target of type annotation which occurs in thethrows
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 theMethodInfo
offoo
, andposition()
would be 0.- Since:
- 2.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jboss.jandex.TypeTarget
TypeTarget.Usage
-
Nested classes/interfaces inherited from interface org.jboss.jandex.AnnotationTarget
AnnotationTarget.Kind
-
-
Constructor Summary
Constructors Constructor Description ThrowsTypeTarget(AnnotationTarget enclosingTarget, Type target, int position)
ThrowsTypeTarget(MethodInfo enclosingTarget, int position)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowsTypeTarget
asThrows()
Casts and returns this type target as aThrowsTypeTarget
.MethodInfo
enclosingTarget()
Returns the enclosing target that contains the type referred to by theTypeTarget.target()
method.TypeTarget.Usage
usage()
Returns the kind of usage of this type target.-
Methods inherited from class org.jboss.jandex.PositionBasedTypeTarget
position
-
Methods inherited from class org.jboss.jandex.TypeTarget
annotation, annotations, annotations, annotationsWithRepeatable, asClass, asClassExtends, asDeclaration, asEmpty, asField, asMethod, asMethodParameter, asMethodParameterType, asRecordComponent, asType, asTypeParameter, asTypeParameterBound, declaredAnnotation, declaredAnnotations, declaredAnnotationsWithRepeatable, hasAnnotation, hasDeclaredAnnotation, isDeclaration, kind, setTarget, target
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.jandex.AnnotationTarget
annotation, annotation, annotations, annotations, annotationsWithRepeatable, annotationsWithRepeatable, declaredAnnotation, declaredAnnotation, declaredAnnotationsWithRepeatable, declaredAnnotationsWithRepeatable, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation
-
-
-
-
Constructor Detail
-
ThrowsTypeTarget
ThrowsTypeTarget(MethodInfo enclosingTarget, int position)
-
ThrowsTypeTarget
ThrowsTypeTarget(AnnotationTarget enclosingTarget, Type target, int position)
-
-
Method Detail
-
usage
public TypeTarget.Usage usage()
Description copied from class:TypeTarget
Returns the kind of usage of this type target. This allows a caller to use a switch statement as opposed togetClass()
comparisons.- Specified by:
usage
in classTypeTarget
- Returns:
- the kind of usage of this type target
-
enclosingTarget
public MethodInfo enclosingTarget()
Description copied from class:TypeTarget
Returns the enclosing target that contains the type referred to by theTypeTarget.target()
method.- Overrides:
enclosingTarget
in classTypeTarget
- Returns:
- the enclosing target
-
asThrows
public ThrowsTypeTarget asThrows()
Description copied from class:TypeTarget
Casts and returns this type target as aThrowsTypeTarget
. If this type target is not aThrowsTypeTarget
, then an exception will be thrown.- Overrides:
asThrows
in classTypeTarget
- Returns:
- an instance of
ThrowsTypeTarget
-
-