|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcheckers.util.AnnotationUtils
@Default(value="checkers.nonnull.quals.NonNull") public class AnnotationUtils
A utility class for working with annotations.
| Constructor Summary | |
|---|---|
AnnotationUtils(ProcessingEnvironment env)
|
|
| Method Summary | ||
|---|---|---|
static Name |
annotationName(AnnotationMirror annotation)
|
|
static Comparator<AnnotationMirror> |
annotationOrdering()
|
|
static
|
createAnnotationMap()
Create a map suitable for storing AnnotationMirror as keys. |
|
static Set<AnnotationMirror> |
createAnnotationSet()
Constructs a Set suitable for storing AnnotationMirrors. |
|
Map<TypeElement,Set<DefaultLocation>> |
findDefaultLocations(Element elt)
Finds default annotations starting at the given element, inspecting the element and its enclosing method and class declarations for Default annotations. |
|
Map<TypeElement,Set<DefaultLocation>> |
findDefaultLocations(TreePath path)
Finds default annotations starting at the leaf of the given tree path by inspecting enclosing variable, method, and class declarations for Default annotations. |
|
static Map<? extends ExecutableElement,? extends AnnotationValue> |
getElementValuesWithDefaults(AnnotationMirror ad)
Returns the values of an annotation's elements, including defaults. |
|
static boolean |
isSame(AnnotationMirror a1,
AnnotationMirror a2)
Checks if both annotations are the same |
|
static
|
parseEnumConstantArrayValue(AnnotationMirror ad,
String field,
Class<R> enumType)
|
|
static Set<String> |
parseStringArrayValue(AnnotationMirror ad,
String field)
|
|
static String |
parseStringValue(AnnotationMirror ad,
String field)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AnnotationUtils(ProcessingEnvironment env)
| Method Detail |
|---|
public Map<TypeElement,Set<DefaultLocation>> findDefaultLocations(TreePath path)
Default annotations.
path - the tree path from which to start searching
TypeElements) to the
DefaultLocations for those annotationsfindDefaultLocations(Element)public Map<TypeElement,Set<DefaultLocation>> findDefaultLocations(Element elt)
Default annotations.
elt - the element from which to start searching
TypeElements) to the
DefaultLocations for those annotationsfindDefaultLocations(TreePath)public static Map<? extends ExecutableElement,? extends AnnotationValue> getElementValuesWithDefaults(AnnotationMirror ad)
ad - annotation to examine
AnnotationMirror.getElementValues()
public static <R extends Enum<R>> Set<R> parseEnumConstantArrayValue(AnnotationMirror ad,
String field,
Class<R> enumType)
R - the enum typead - the annotation for which a value will be parsedfield - the name of the field to parseenumType - the type of the enum
public static String parseStringValue(AnnotationMirror ad,
String field)
ad - the annotation for which a value will be parsedfield - the name of the field to parse
public static Set<String> parseStringArrayValue(AnnotationMirror ad,
String field)
ad - the annotation for which a value will be parsedfield - the name of the field to parse
public static final Name annotationName(AnnotationMirror annotation)
public static boolean isSame(AnnotationMirror a1,
AnnotationMirror a2)
public static Comparator<AnnotationMirror> annotationOrdering()
public static <V> Map<AnnotationMirror,V> createAnnotationMap()
AnnotationMirror as keys.
It can store one instance of AnnotationMirror of a given
declared type, regardless of the annotation element values.
V - the value of the map
AnnotationMirror as keypublic static Set<AnnotationMirror> createAnnotationSet()
Set suitable for storing AnnotationMirrors.
It stores at most once instance of AnnotationMirror of a given
type, regardless of the annotation element values.
AnnotationMirror as element
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||