Class AnnotationConverter
java.lang.Object
org.checkerframework.common.wholeprograminference.AnnotationConverter
This class contains static methods that convert between
Annotation and AnnotationMirror.-
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddFieldToAnnotationBuilder(String fieldKey, Object obj, AnnotationBuilder builder) Adds a field to an AnnotationBuilder.static AnnotationConverts anAnnotationMirrorinto anAnnotation.protected static AnnotationMirrorannotationToAnnotationMirror(Annotation anno, ProcessingEnvironment processingEnv) Converts anAnnotationinto anAnnotationMirror.protected static @Nullable AnnotationFieldTypeReturns the type of an element (that is, a field) of an annotation.protected static AnnotationFieldTypeConverts a TypeMirror to an AnnotationFieldType.
-
Method Details
-
annotationMirrorToAnnotation
Converts anAnnotationMirrorinto anAnnotation.- Parameters:
am- the AnnotationMirror- Returns:
- the Annotation
-
annotationToAnnotationMirror
protected static AnnotationMirror annotationToAnnotationMirror(Annotation anno, ProcessingEnvironment processingEnv) Converts anAnnotationinto anAnnotationMirror.- Parameters:
anno- the AnnotationprocessingEnv- the ProcessingEnvironment- Returns:
- the AnnotationMirror
-
getAnnotationFieldType
Returns the type of an element (that is, a field) of an annotation.- Parameters:
ee- an element (that is, a field) of an annotation- Returns:
- the type of the given annotation field
-
typeMirrorToAnnotationFieldType
Converts a TypeMirror to an AnnotationFieldType.- Parameters:
tm- a type for an annotation element/field: primitive, String, class, enum constant, or array thereof- Returns:
- an AnnotationFieldType corresponding to the argument
-
addFieldToAnnotationBuilder
protected static void addFieldToAnnotationBuilder(String fieldKey, Object obj, AnnotationBuilder builder) Adds a field to an AnnotationBuilder.- Parameters:
fieldKey- is the name of the fieldobj- is the value of the fieldbuilder- is the AnnotationBuilder
-