use of scenelib.annotations.field.BasicAFT in project j2objc by google.
the class ExternalAnnotationInjector method generateAnnotationField.
private AnnotationField generateAnnotationField(Annotation annotation, AnnotationFieldType type, String name, String value) {
AnnotationField field = new AnnotationField();
if (type instanceof BasicAFT) {
Class<?> enclosedType = ((BasicAFT) type).type;
if (String.class.isAssignableFrom(enclosedType)) {
field.element = GeneratedExecutableElement.newMethodWithSelector(name, typeUtil.getJavaString().asType(), null);
field.value = new GeneratedAnnotationValue(value);
} else {
ErrorUtil.error("ExternalAnnotationInjector: unsupported field type " + type);
}
} else if (type instanceof EnumAFT) {
String enumTypeString = annotation.def.name + "." + ((EnumAFT) type).typeName;
TypeMirror enumType = typeUtil.resolveJavaType(enumTypeString).asType();
field.element = GeneratedExecutableElement.newMethodWithSelector(name, enumType, /* enclosingElement = */
null);
field.value = new GeneratedAnnotationValue(GeneratedVariableElement.newParameter(value, enumType, /* enclosingElement = */
null));
} else {
ErrorUtil.error("ExternalAnnotationInjector: unsupported field type " + type);
}
return field;
}
Aggregations