use of com.google.devtools.j2objc.ast.FunctionInvocation in project j2objc by google.
the class TranslationUtil method createAnnotation.
public Expression createAnnotation(AnnotationMirror annotationMirror) {
DeclaredType type = annotationMirror.getAnnotationType();
TypeElement typeElem = (TypeElement) type.asElement();
FunctionElement element = new FunctionElement("create_" + nameTable.getFullName(typeElem), type, typeElem);
FunctionInvocation invocation = new FunctionInvocation(element, type);
Map<? extends ExecutableElement, ? extends AnnotationValue> values = typeUtil.elementUtil().getElementValuesWithDefaults(annotationMirror);
for (ExecutableElement member : ElementUtil.getSortedAnnotationMembers(typeElem)) {
TypeMirror valueType = member.getReturnType();
element.addParameters(valueType);
invocation.addArgument(createAnnotationValue(valueType, values.get(member)));
}
return invocation;
}
Aggregations