@SuppressWarnings("unchecked")
@Override
protected ASTRewrite getRewrite() throws CoreException {
CompilationUnit astRoot = ASTResolving.findParentCompilationUnit(decl);
ASTRewrite astRewrite = ASTRewrite.create(astRoot.getAST());
AST ast = astRewrite.getAST();
ImportRewrite importRewrite = createImportRewrite(astRoot);
if (params.length == 0) {
createAnnotation(Autowired.class.getCanonicalName(), Autowired.class.getSimpleName(), astRoot, ast,
astRewrite, importRewrite, false, null);
}
else {
NormalAnnotation autowiredAnnotation = (NormalAnnotation) createAnnotation(Autowired.class
.getCanonicalName(), Autowired.class.getSimpleName(), astRoot, ast, astRewrite, importRewrite,
true, null);
for (int i = 0; i < params.length; i++) {
switch (params[i]) {
case REQUIRED:
MemberValuePair requiredValue = ast.newMemberValuePair();
requiredValue.setName(ast.newSimpleName("required"));
requiredValue.setValue(ast.newBooleanLiteral(false));
addLinkedPosition(astRewrite.track(requiredValue.getValue()), i == 0, "Autowire");
autowiredAnnotation.values().add(requiredValue);
break;
// case QUALIFIER:
// SingleMemberAnnotation qualifierAnnotation =
// (SingleMemberAnnotation) createAnnotation(