use of com.redhat.ceylon.compiler.java.codegen.AnnotationArgument in project ceylon-compiler by ceylon.
the class AnnotationLoader method loadAnnotationInvocationArguments.
private void loadAnnotationInvocationArguments(List<AnnotationFieldName> path, LazyFunction method, AnnotationInvocation ai, AnnotationMirror annotationInvocationAnnotation, List<AnnotationMirror> annotationTree, AnnotatedMirror dpm) {
@SuppressWarnings("unchecked") List<Short> argumentCodes = (List<Short>) annotationInvocationAnnotation.getValue(AbstractModelLoader.CEYLON_ANNOTATION_INSTANTIATION_ARGUMENTS_MEMBER);
if (argumentCodes != null) {
for (int ii = 0; ii < argumentCodes.size(); ii++) {
short code = argumentCodes.get(ii);
AnnotationArgument argument = new AnnotationArgument();
Parameter classParameter = ai.getParameters().get(ii);
argument.setParameter(classParameter);
path.add(argument);
argument.setTerm(loadAnnotationArgumentTerm(path, method, ai, classParameter, annotationTree, dpm, code));
path.remove(path.size() - 1);
ai.getAnnotationArguments().add(argument);
}
}
}
use of com.redhat.ceylon.compiler.java.codegen.AnnotationArgument in project ceylon-compiler by ceylon.
the class AnnotationLoader method makeInterorAnnotationConstructorInvocation.
public void makeInterorAnnotationConstructorInvocation(AnnotationProxyMethod ctor, AnnotationProxyClass klass, java.util.List<Parameter> ctorParams) {
AnnotationInvocation ai = new AnnotationInvocation();
ai.setConstructorDeclaration(ctor);
ai.setPrimary(klass);
ai.setInterop(true);
ctor.setAnnotationConstructor(ai);
java.util.List<AnnotationArgument> annotationArgs = new ArrayList<AnnotationArgument>();
for (Parameter ctorParam : ctorParams) {
boolean isValue = ctorParam.getName().equals("value");
ParameterAnnotationTerm term = new ParameterAnnotationTerm();
AnnotationArgument argument = new AnnotationArgument();
argument.setTerm(term);
argument.setParameter(klass.getParameter(ctorParam.getName()));
term.setSourceParameter(ctorParam);
AnnotationConstructorParameter acp = new AnnotationConstructorParameter();
acp.setParameter(ctorParam);
if (isValue)
ai.getConstructorParameters().add(0, acp);
else
ai.getConstructorParameters().add(acp);
annotationArgs.add(argument);
}
ai.getAnnotationArguments().addAll(annotationArgs);
}
Aggregations