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 void
addFieldToAnnotationBuilder
(String fieldKey, Object obj, AnnotationBuilder builder) Adds a field to an AnnotationBuilder.static org.checkerframework.afu.scenelib.Annotation
Converts anAnnotationMirror
into anAnnotation
.protected static AnnotationMirror
annotationToAnnotationMirror
(org.checkerframework.afu.scenelib.Annotation anno, ProcessingEnvironment processingEnv) Converts anAnnotation
into anAnnotationMirror
.protected static @Nullable org.checkerframework.afu.scenelib.field.AnnotationFieldType
Returns the type of an element (that is, a field) of an annotation.protected static org.checkerframework.afu.scenelib.field.AnnotationFieldType
Converts a TypeMirror to an AnnotationFieldType.
-
Method Details
-
annotationMirrorToAnnotation
public static org.checkerframework.afu.scenelib.Annotation annotationMirrorToAnnotation(AnnotationMirror am) Converts anAnnotationMirror
into anAnnotation
.- Parameters:
am
- the AnnotationMirror- Returns:
- the Annotation
-
annotationToAnnotationMirror
protected static AnnotationMirror annotationToAnnotationMirror(org.checkerframework.afu.scenelib.Annotation anno, ProcessingEnvironment processingEnv) Converts anAnnotation
into anAnnotationMirror
.- Parameters:
anno
- the AnnotationprocessingEnv
- the ProcessingEnvironment- Returns:
- the AnnotationMirror
-
getAnnotationFieldType
protected static @Nullable org.checkerframework.afu.scenelib.field.AnnotationFieldType getAnnotationFieldType(ExecutableElement ee) 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
protected static org.checkerframework.afu.scenelib.field.AnnotationFieldType typeMirrorToAnnotationFieldType(TypeMirror tm) 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
-