public abstract class TypeTarget extends Object implements AnnotationTarget
It is expected that callers will traverse the full tree from the specified starting point, since this context is important in interpreting the meaning of the type annotation
EmptyTypeTarget,
ClassExtendsTypeTarget,
TypeParameterTypeTarget,
TypeParameterBoundTypeTarget,
MethodParameterTypeTarget,
ThrowsTypeTarget| Modifier and Type | Class and Description |
|---|---|
static class |
TypeTarget.Usage
Specifies a form of usage of a type annotation
|
AnnotationTarget.Kind| Modifier and Type | Method and Description |
|---|---|
ClassInfo |
asClass()
Casts and returns this target as a
ClassInfo if it is of kind CLASS |
ClassExtendsTypeTarget |
asClassExtends()
Casts and returns this type target as a
ClassExtendsTypeTarget. |
EmptyTypeTarget |
asEmpty() |
FieldInfo |
asField()
Casts and returns this target as a
FieldInfo if it is of kind FIELD |
MethodInfo |
asMethod()
Casts and returns this target as a
MethodInfo if it is of kind METHOD |
MethodParameterInfo |
asMethodParameter()
Casts and returns this target as a
MethodParameterInfo if it is of kind METHOD_PARAMETER |
MethodParameterTypeTarget |
asMethodParameterType()
Casts and returns this type target as a
MethodParameterTypeTarget. |
ThrowsTypeTarget |
asThrows()
Casts and returns this type target as a
ThrowsTypeTarget. |
TypeTarget |
asType()
Casts and returns this target as a
TypeTarget if it is of kind TYPE |
TypeParameterTypeTarget |
asTypeParameter()
Casts and returns this type target as a
TypeParameterTypeTarget. |
TypeParameterBoundTypeTarget |
asTypeParameterBound()
Casts and returns this type target as a
TypeParameterBoundTypeTarget. |
AnnotationTarget |
enclosingTarget()
Returns the enclosing target that contains the type referred to by the
target() method. |
AnnotationTarget.Kind |
kind()
Returns the kind of object this target represents.
|
Type |
target()
Returns the type which contains the respective annotation.
|
abstract TypeTarget.Usage |
usage()
Returns the kind of usage of this type target.
|
public final AnnotationTarget.Kind kind()
AnnotationTargetkind in interface AnnotationTargetpublic AnnotationTarget enclosingTarget()
target() method.public Type target()
public abstract TypeTarget.Usage usage()
getClass() comparisons.public EmptyTypeTarget asEmpty()
public ClassExtendsTypeTarget asClassExtends()
ClassExtendsTypeTarget. If this type target
is not a ClassExtendsTypeTarget, then an exception will be thrown.ClassExtendsTypeTargetIllegalArgumentException - if this is not a ClassExtendsTypeTargetpublic MethodParameterTypeTarget asMethodParameterType()
MethodParameterTypeTarget. If this type target
is not a MethodParameterTypeTarget, then an exception will be thrown.MethodParameterTypeTargetIllegalArgumentException - if this is not a MethodParameterTypeTargetpublic TypeParameterTypeTarget asTypeParameter()
TypeParameterTypeTarget. If this type target
is not a TypeParameterTypeTarget, then an exception will be thrown.TypeParameterTypeTargetIllegalArgumentException - if this is not a TypeParameterTypeTargetpublic TypeParameterBoundTypeTarget asTypeParameterBound()
TypeParameterBoundTypeTarget. If this type target
is not a TypeParameterBoundTypeTarget, then an exception will be thrown.TypeParameterBoundTypeTargetIllegalArgumentException - if this is not a TypeParameterBoundTypeTargetpublic ThrowsTypeTarget asThrows()
ThrowsTypeTarget. If this type target
is not a ThrowsTypeTarget, then an exception will be thrown.ThrowsTypeTargetIllegalArgumentException - if this is not a TypeParameterBoundTypeTargetpublic final ClassInfo asClass()
AnnotationTargetClassInfo if it is of kind CLASSasClass in interface AnnotationTargetpublic final FieldInfo asField()
AnnotationTargetFieldInfo if it is of kind FIELDasField in interface AnnotationTargetpublic final MethodInfo asMethod()
AnnotationTargetMethodInfo if it is of kind METHODasMethod in interface AnnotationTargetpublic final MethodParameterInfo asMethodParameter()
AnnotationTargetMethodParameterInfo if it is of kind METHOD_PARAMETERasMethodParameter in interface AnnotationTargetpublic final TypeTarget asType()
AnnotationTargetTypeTarget if it is of kind TYPEasType in interface AnnotationTargetCopyright © 2025 JBoss by Red Hat. All rights reserved.