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 NormalAnnotation extends Annotation { 20 21 public MemberValuePair[] memberValuePairs; 22 23 public NormalAnnotation(TypeReference type, int sourceStart) { 24 this.type = type; 25 this.sourceStart = sourceStart; 26 this.sourceEnd = type.sourceEnd; 27 } 28 29 public ElementValuePair[] computeElementValuePairs() { 30 int numberOfPairs = this.memberValuePairs == null ? 0 : this.memberValuePairs.length; 31 if (numberOfPairs == 0) 32 return Binding.NO_ELEMENT_VALUE_PAIRS; 33 34 ElementValuePair[] pairs = new ElementValuePair[numberOfPairs]; 35 for (int i = 0; i < numberOfPairs; i++) 36 pairs[i] = this.memberValuePairs[i].compilerElementPair; 37 return pairs; 38 } 39 40 43 public MemberValuePair[] memberValuePairs() { 44 return this.memberValuePairs == null ? NoValuePairs : this.memberValuePairs; 45 } 46 public StringBuffer printExpression(int indent, StringBuffer output) { 47 super.printExpression(indent, output); 48 output.append('('); 49 if (this.memberValuePairs != null) { 50 for (int i = 0, max = this.memberValuePairs.length; i < max; i++) { 51 if (i > 0) { 52 output.append(','); 53 } 54 this.memberValuePairs[i].print(indent, output); 55 } 56 } 57 output.append(')'); 58 return output; 59 } 60 61 public void traverse(ASTVisitor visitor, BlockScope scope) { 62 if (visitor.visit(this, scope)) { 63 if (this.memberValuePairs != null) { 64 int memberValuePairsLength = this.memberValuePairs.length; 65 for (int i = 0; i < memberValuePairsLength; i++) 66 this.memberValuePairs[i].traverse(visitor, scope); 67 } 68 } 69 visitor.endVisit(this, scope); 70 } 71 } 72 | Popular Tags |