/** * <pre> * @Outer("lorem ipsum") => @Outer(@Inner) * </pre> */ @Override protected void modifyAnnotationValue(SingleMemberAnnotation outer, Annotation inner) { // replace(?) the current element value outer.setValue(inner); }
public void setExpression(ASTNode node, Expression expression) { ((SingleMemberAnnotation) node).setValue(expression); } @Override
/** * Builds a new {@link SingleMemberAnnotation} instance. * * @param typeName the annotation type name * @param value the annotation single value * @return a new single member annotation */ public SingleMemberAnnotation singleValueAnnotation(Name typeName, Expression value) { final SingleMemberAnnotation sma = ast.newSingleMemberAnnotation(); sma.setTypeName(typeName); sma.setValue(value); return sma; }
/** * add non-null, non-empty value */ protected void setValueNoAnnotation(Expression value, ModifiedDeclaration declaration) { if (this.elementName.equals("value")) { // @Foo("xxx") this.annotationAdapter.newSingleMemberAnnotation(declaration).setValue(value); } else { // @Foo(bar="xxx") this.addValue(value, this.annotationAdapter.newNormalAnnotation(declaration)); } }
protected void setValueSingleMemberAnnotation(Expression value, SingleMemberAnnotation annotation, ModifiedDeclaration declaration) { if (this.elementName.equals("value")) { // @Foo("yyy") => @Foo("xxx") annotation.setValue(value); } else { // @Foo("yyy") => @Foo(value="yyy", bar="xxx") Expression vv = annotation.getValue(); vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv); NormalAnnotation normalAnnotation = this.annotationAdapter.newNormalAnnotation(declaration); this.addValue(vv, normalAnnotation, "value"); this.addValue(value, normalAnnotation); } }
public SingleMemberAnnotation createCatchMark(String catchMark) { SingleMemberAnnotation supp = ast.newSingleMemberAnnotation(); supp.setTypeName(ast.newSimpleName("SuppressWarnings")); StringLiteral sl = ast.newStringLiteral(); sl.setLiteralValue(catchMark); supp.setValue(sl); return supp; }
public SingleMemberAnnotation convert(org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation annotation) { final SingleMemberAnnotation singleMemberAnnotation = new SingleMemberAnnotation(this.ast); setTypeNameForAnnotation(annotation, singleMemberAnnotation); singleMemberAnnotation.setValue(convert(annotation.memberValue)); int start = annotation.sourceStart; int end = annotation.declarationSourceEnd; singleMemberAnnotation.setSourceRange(start, end - start + 1); if (this.resolveBindings) { recordNodes(singleMemberAnnotation, annotation); singleMemberAnnotation.resolveAnnotationBinding(); } return singleMemberAnnotation; }
public SingleMemberAnnotation convert(org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation annotation) { final SingleMemberAnnotation singleMemberAnnotation = new SingleMemberAnnotation(this.ast); setTypeNameForAnnotation(annotation, singleMemberAnnotation); singleMemberAnnotation.setValue(convert(annotation.memberValue)); int start = annotation.sourceStart; int end = annotation.declarationSourceEnd; singleMemberAnnotation.setSourceRange(start, end - start + 1); if (this.resolveBindings) { recordNodes(singleMemberAnnotation, annotation); singleMemberAnnotation.resolveAnnotationBinding(); } return singleMemberAnnotation; }
public SingleMemberAnnotation convert(org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation annotation) { final SingleMemberAnnotation singleMemberAnnotation = new SingleMemberAnnotation(this.ast); setTypeNameForAnnotation(annotation, singleMemberAnnotation); singleMemberAnnotation.setValue(convert(annotation.memberValue)); int start = annotation.sourceStart; int end = annotation.declarationSourceEnd; singleMemberAnnotation.setSourceRange(start, end - start + 1); if (this.resolveBindings) { recordNodes(singleMemberAnnotation, annotation); singleMemberAnnotation.resolveAnnotationBinding(); } return singleMemberAnnotation; }
public SingleMemberAnnotation convert(org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation annotation) { final SingleMemberAnnotation singleMemberAnnotation = new SingleMemberAnnotation(this.ast); setTypeNameForAnnotation(annotation, singleMemberAnnotation); singleMemberAnnotation.setValue(convert(annotation.memberValue)); int start = annotation.sourceStart; int end = annotation.declarationSourceEnd; singleMemberAnnotation.setSourceRange(start, end - start + 1); if (this.resolveBindings) { recordNodes(singleMemberAnnotation, annotation); singleMemberAnnotation.resolveAnnotationBinding(); } return singleMemberAnnotation; }
public SingleMemberAnnotation convert(org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation annotation) { final SingleMemberAnnotation singleMemberAnnotation = new SingleMemberAnnotation(this.ast); setTypeNameForAnnotation(annotation, singleMemberAnnotation); singleMemberAnnotation.setValue(convert(annotation.memberValue)); int start = annotation.sourceStart; int end = annotation.declarationSourceEnd; singleMemberAnnotation.setSourceRange(start, end - start + 1); if (this.resolveBindings) { recordNodes(singleMemberAnnotation, annotation); singleMemberAnnotation.resolveAnnotationBinding(); } return singleMemberAnnotation; }
public SingleMemberAnnotation convert(org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation annotation) { final SingleMemberAnnotation singleMemberAnnotation = new SingleMemberAnnotation(this.ast); setTypeNameForAnnotation(annotation, singleMemberAnnotation); singleMemberAnnotation.setValue(convert(annotation.memberValue)); int start = annotation.sourceStart; int end = annotation.declarationSourceEnd; singleMemberAnnotation.setSourceRange(start, end - start + 1); if (this.resolveBindings) { recordNodes(singleMemberAnnotation, annotation); singleMemberAnnotation.resolveAnnotationBinding(); } return singleMemberAnnotation; }
@Override public AnnotationSource<O> setAnnotationValue() { if (isMarker()) { convertTo(AnnotationType.SINGLE); } if (isSingleValue()) { final AnnotationSource<O> result = new Nested(this); ((SingleMemberAnnotation) annotation).setValue((Expression) result.getInternal()); return result; } return setAnnotationValue(DEFAULT_VALUE); }
@Override public AnnotationSource<O> setAnnotationValue() { if (isMarker()) { convertTo(AnnotationType.SINGLE); } if (isSingleValue()) { final AnnotationSource<O> result = new Nested(this); ((SingleMemberAnnotation) annotation).setValue((Expression) result.getInternal()); return result; } return setAnnotationValue(DEFAULT_VALUE); }
@Override ASTNode clone0(AST target) { SingleMemberAnnotation result = new SingleMemberAnnotation(target); result.setSourceRange(getStartPosition(), getLength()); result.setTypeName((Name) ASTNode.copySubtree(target, getTypeName())); result.setValue((Expression) ASTNode.copySubtree(target, getValue())); return result; }
ASTNode clone0(AST target) { SingleMemberAnnotation result = new SingleMemberAnnotation(target); result.setSourceRange(getStartPosition(), getLength()); result.setTypeName((Name) ASTNode.copySubtree(target, getTypeName())); result.setValue((Expression) ASTNode.copySubtree(target, getValue())); return result; }
ASTNode clone0(AST target) { SingleMemberAnnotation result = new SingleMemberAnnotation(target); result.setSourceRange(getStartPosition(), getLength()); result.setTypeName((Name) ASTNode.copySubtree(target, getTypeName())); result.setValue((Expression) ASTNode.copySubtree(target, getValue())); return result; }
ASTNode clone0(AST target) { SingleMemberAnnotation result = new SingleMemberAnnotation(target); result.setSourceRange(getStartPosition(), getLength()); result.setTypeName((Name) ASTNode.copySubtree(target, getTypeName())); result.setValue((Expression) ASTNode.copySubtree(target, getValue())); return result; }
ASTNode clone0(AST target) { SingleMemberAnnotation result = new SingleMemberAnnotation(target); result.setSourceRange(getStartPosition(), getLength()); result.setTypeName((Name) ASTNode.copySubtree(target, getTypeName())); result.setValue((Expression) ASTNode.copySubtree(target, getValue())); return result; }
ASTNode clone0(AST target) { SingleMemberAnnotation result = new SingleMemberAnnotation(target); result.setSourceRange(getStartPosition(), getLength()); result.setTypeName((Name) ASTNode.copySubtree(target, getTypeName())); result.setValue((Expression) ASTNode.copySubtree(target, getValue())); return result; }