private void printAnnotationCreate(List<Annotation> runtimeAnnotations) { print(" return [IOSObjectArray arrayWithObjects:(id[]) { "); printAnnotations(runtimeAnnotations); printf( " } count:%d type:[IOSClass " + "classWithProtocol:@protocol(JavaLangAnnotationAnnotation)]];\n}\n\n", runtimeAnnotations.size()); }
private void printParameterAnnotationMethods(MethodDeclaration method) { List<SingleVariableDeclaration> params = ASTUtil.getParameters(method); // Quick test to see if there are any parameter annotations. boolean hasAnnotations = false; for (SingleVariableDeclaration param : params) { List<Annotation> runtimeAnnotations = ASTUtil.getRuntimeAnnotations(ASTUtil.getModifiers(param)); if (runtimeAnnotations.size() > 0) { hasAnnotations = true; break; } } if (hasAnnotations) { // Print array of arrays, with an element in the outer array for each parameter. printf( "+ (IOSObjectArray *)__annotations_%s_params {\n", methodKey(Types.getMethodBinding(method))); print(" return [IOSObjectArray arrayWithObjects:(id[]) { "); for (int i = 0; i < params.size(); i++) { if (i > 0) { print(", "); } SingleVariableDeclaration param = params.get(i); List<Annotation> runtimeAnnotations = ASTUtil.getRuntimeAnnotations(ASTUtil.getModifiers(param)); if (runtimeAnnotations.size() > 0) { print("[IOSObjectArray arrayWithObjects:(id[]) { "); printAnnotations(runtimeAnnotations); printf( " } count:%d type:[IOSClass classWithProtocol:" + "@protocol(JavaLangAnnotationAnnotation)]]", runtimeAnnotations.size()); } else { print( "[IOSObjectArray arrayWithLength:0 " + "type:[IOSClass classWithProtocol:@protocol(JavaLangAnnotationAnnotation)]]"); } } printf( " } count:%d type:[IOSClass classWithProtocol:" + "@protocol(JavaLangAnnotationAnnotation)]];\n}\n", params.size()); } }