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()
AnnotationTarget
kind
in interface AnnotationTarget
public 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.ClassExtendsTypeTarget
IllegalArgumentException
- if this is not a ClassExtendsTypeTarget
public MethodParameterTypeTarget asMethodParameterType()
MethodParameterTypeTarget
. If this type target
is not a MethodParameterTypeTarget
, then an exception will be thrown.MethodParameterTypeTarget
IllegalArgumentException
- if this is not a MethodParameterTypeTarget
public TypeParameterTypeTarget asTypeParameter()
TypeParameterTypeTarget
. If this type target
is not a TypeParameterTypeTarget
, then an exception will be thrown.TypeParameterTypeTarget
IllegalArgumentException
- if this is not a TypeParameterTypeTarget
public TypeParameterBoundTypeTarget asTypeParameterBound()
TypeParameterBoundTypeTarget
. If this type target
is not a TypeParameterBoundTypeTarget
, then an exception will be thrown.TypeParameterBoundTypeTarget
IllegalArgumentException
- if this is not a TypeParameterBoundTypeTarget
public ThrowsTypeTarget asThrows()
ThrowsTypeTarget
. If this type target
is not a ThrowsTypeTarget
, then an exception will be thrown.ThrowsTypeTarget
IllegalArgumentException
- if this is not a TypeParameterBoundTypeTarget
public final ClassInfo asClass()
AnnotationTarget
ClassInfo
if it is of kind CLASS
asClass
in interface AnnotationTarget
public final FieldInfo asField()
AnnotationTarget
FieldInfo
if it is of kind FIELD
asField
in interface AnnotationTarget
public final MethodInfo asMethod()
AnnotationTarget
MethodInfo
if it is of kind METHOD
asMethod
in interface AnnotationTarget
public final MethodParameterInfo asMethodParameter()
AnnotationTarget
MethodParameterInfo
if it is of kind METHOD_PARAMETER
asMethodParameter
in interface AnnotationTarget
public final TypeTarget asType()
AnnotationTarget
TypeTarget
if it is of kind TYPE
asType
in interface AnnotationTarget
Copyright © 2018 JBoss by Red Hat. All rights reserved.