For example, the assignment expression foo = true is generated by the following snippet: Assignment e= ast.newAssignment(); e.setLeftHandSide(ast.newSimpleName("foo")); e.setRightHandSide(ast.newBooleanLiteral(true));
foo = true
Assignment e= ast.newAssignment(); e.setLeftHandSide(ast.newSimpleName("foo")); e.setRightHandSide(ast.newBooleanLiteral(true));
4647484950515253545556
AST ast = annotation.getAST(); ASTRewrite astRewrite = ASTRewrite.create(ast); // change required=true to required = false if (valuePair != null) { astRewrite.replace(valuePair.getValue(), ast.newBooleanLiteral(false), null); return astRewrite; } // add required=false to annotation else {
5758596061626364656667
NormalAnnotation newAnnotation = ast.newNormalAnnotation(); newAnnotation.setTypeName(ast.newSimpleName(annotation.getTypeName().getFullyQualifiedName())); MemberValuePair requiredValue = ast.newMemberValuePair(); requiredValue.setName(ast.newSimpleName("required")); requiredValue.setValue(ast.newBooleanLiteral(false)); newAnnotation.values().add(requiredValue); astRewrite.replace(annotation, newAnnotation, null); }
102103104105106107108109110111112
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 =