use of com.google.devtools.j2objc.types.GeneratedAnnotationMirror in project j2objc by google.
the class ExternalAnnotationInjector method generateAnnotationMirror.
private GeneratedAnnotationMirror generateAnnotationMirror(Annotation annotation) {
TypeElement element = typeUtil.resolveJavaType(annotation.def.name);
if (element == null) {
reportNoSuchClass(annotation);
return null;
}
DeclaredType type = (DeclaredType) element.asType();
GeneratedAnnotationMirror annotationMirror = new GeneratedAnnotationMirror(type);
for (Map.Entry<String, Object> entry : annotation.fieldValues.entrySet()) {
String fieldName = entry.getKey();
// For our uses cases, the scenelib library encodes the annotation value as a string.
String fieldValue = (String) entry.getValue();
AnnotationFieldType fieldType = annotation.def.fieldTypes.get(fieldName);
AnnotationField field = generateAnnotationField(annotation, fieldType, fieldName, fieldValue);
annotationMirror.addElementValue(field.element, field.value);
}
return annotationMirror;
}
Aggregations