public class AnnotationTargetUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Set<PsiAnnotation.TargetType> |
DEFAULT_TARGETS |
Constructor and Description |
---|
AnnotationTargetUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.Set<PsiAnnotation.TargetType> |
extractRequiredAnnotationTargets(PsiAnnotationMemberValue value) |
static PsiAnnotation.TargetType |
findAnnotationTarget(PsiAnnotation annotation,
PsiAnnotation.TargetType... types)
From given targets, returns first where the annotation may be applied.
|
static PsiAnnotation.TargetType |
findAnnotationTarget(PsiClass annotationType,
PsiAnnotation.TargetType... types)
From given targets, returns first where the annotation may be applied.
|
static java.util.Set<PsiAnnotation.TargetType> |
getAnnotationTargets(PsiClass annotationType)
Returns a set of targets where the given annotation may be applied, or
null when the type is not a valid annotation. |
static PsiAnnotationOwner |
getTarget(PsiModifierListOwner modifierListOwner,
java.lang.String annotation) |
static PsiAnnotation.TargetType [] |
getTargetsForLocation(PsiAnnotationOwner owner) |
static boolean |
isTypeAnnotation(PsiAnnotation element)
Returns
true if the annotation resolves to a class having PsiAnnotation.TargetType.TYPE_USE in it's targets. |
public static final java.util.Set<PsiAnnotation.TargetType> DEFAULT_TARGETS
public static PsiAnnotation.TargetType [] getTargetsForLocation(PsiAnnotationOwner owner)
public static java.util.Set<PsiAnnotation.TargetType> extractRequiredAnnotationTargets(PsiAnnotationMemberValue value)
public static boolean isTypeAnnotation(PsiAnnotation element)
true
if the annotation resolves to a class having PsiAnnotation.TargetType.TYPE_USE
in it's targets.public static PsiAnnotation.TargetType findAnnotationTarget(PsiAnnotation annotation, PsiAnnotation.TargetType... types)
null
when the annotation is not applicable
at any of the targets, or PsiAnnotation.TargetType.UNKNOWN if the annotation does not resolve to a valid annotation type.public static PsiAnnotation.TargetType findAnnotationTarget(PsiClass annotationType, PsiAnnotation.TargetType... types)
null
when the annotation is not applicable
at any of the targets, or PsiAnnotation.TargetType.UNKNOWN if the type is not a valid annotation (e.g. cannot be resolved).public static java.util.Set<PsiAnnotation.TargetType> getAnnotationTargets(PsiClass annotationType)
null
when the type is not a valid annotation.public static PsiAnnotationOwner getTarget(PsiModifierListOwner modifierListOwner, java.lang.String annotation)
modifierListOwner
- modifier list ownerannotation
- the qualified name of the annotation to addmodifierListOwner.getModifierList()
is null.