1 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.ASTVisitor; 14 import org.eclipse.jdt.internal.compiler.lookup.*; 15 16 19 public class SingleMemberAnnotation extends Annotation { 20 21 public Expression memberValue; 22 private MemberValuePair[] singlePairs; 24 public SingleMemberAnnotation(TypeReference type, int sourceStart) { 25 this.type = type; 26 this.sourceStart = sourceStart; 27 this.sourceEnd = type.sourceEnd; 28 } 29 30 public ElementValuePair[] computeElementValuePairs() { 31 return new ElementValuePair[] {memberValuePairs()[0].compilerElementPair}; 32 } 33 34 37 public MemberValuePair[] memberValuePairs() { 38 if (this.singlePairs == null) { 39 this.singlePairs = 40 new MemberValuePair[]{ 41 new MemberValuePair(VALUE, this.memberValue.sourceStart, this.memberValue.sourceEnd, this.memberValue) 42 }; 43 } 44 return this.singlePairs; 45 } 46 47 public StringBuffer printExpression(int indent, StringBuffer output) { 48 super.printExpression(indent, output); 49 output.append('('); 50 this.memberValue.printExpression(indent, output); 51 return output.append(')'); 52 } 53 54 public void traverse(ASTVisitor visitor, BlockScope scope) { 55 if (visitor.visit(this, scope)) { 56 if (this.memberValue != null) { 57 this.memberValue.traverse(visitor, scope); 58 } 59 } 60 visitor.endVisit(this, scope); 61 } 62 } 63 | Popular Tags |