1 11 package org.eclipse.jdt.core.dom; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 27 public final class NormalAnnotation extends Annotation { 28 29 32 public static final ChildPropertyDescriptor TYPE_NAME_PROPERTY = 33 internalTypeNamePropertyFactory(NormalAnnotation.class); 34 35 38 public static final ChildListPropertyDescriptor VALUES_PROPERTY = 39 new ChildListPropertyDescriptor(NormalAnnotation.class, "values", MemberValuePair.class, CYCLE_RISK); 41 46 private static final List PROPERTY_DESCRIPTORS; 47 48 static { 49 List propertyList = new ArrayList (3); 50 createPropertyList(NormalAnnotation.class, propertyList); 51 addProperty(TYPE_NAME_PROPERTY, propertyList); 52 addProperty(VALUES_PROPERTY, propertyList); 53 PROPERTY_DESCRIPTORS = reapPropertyList(propertyList); 54 } 55 56 64 public static List propertyDescriptors(int apiLevel) { 65 return PROPERTY_DESCRIPTORS; 66 } 67 68 72 private ASTNode.NodeList values = 73 new ASTNode.NodeList(VALUES_PROPERTY); 74 75 86 NormalAnnotation(AST ast) { 87 super(ast); 88 unsupportedIn2(); 89 } 90 91 94 final List internalStructuralPropertiesForType(int apiLevel) { 95 return propertyDescriptors(apiLevel); 96 } 97 98 101 final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { 102 if (property == TYPE_NAME_PROPERTY) { 103 if (get) { 104 return getTypeName(); 105 } else { 106 setTypeName((Name) child); 107 return null; 108 } 109 } 110 return super.internalGetSetChildProperty(property, get, child); 112 } 113 114 117 final List internalGetChildListProperty(ChildListPropertyDescriptor property) { 118 if (property == VALUES_PROPERTY) { 119 return values(); 120 } 121 return super.internalGetChildListProperty(property); 123 } 124 125 128 final ChildPropertyDescriptor internalTypeNameProperty() { 129 return TYPE_NAME_PROPERTY; 130 } 131 132 135 final int getNodeType0() { 136 return NORMAL_ANNOTATION; 137 } 138 139 142 ASTNode clone0(AST target) { 143 NormalAnnotation result = new NormalAnnotation(target); 144 result.setSourceRange(this.getStartPosition(), this.getLength()); 145 result.setTypeName((Name) ASTNode.copySubtree(target, getTypeName())); 146 result.values().addAll(ASTNode.copySubtrees(target, values())); 147 return result; 148 } 149 150 153 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 154 return matcher.match(this, other); 156 } 157 158 161 void accept0(ASTVisitor visitor) { 162 boolean visitChildren = visitor.visit(this); 163 if (visitChildren) { 164 acceptChild(visitor, getTypeName()); 166 acceptChildren(visitor, this.values); 167 } 168 visitor.endVisit(this); 169 } 170 171 181 public List values() { 182 return this.values; 183 } 184 185 188 int memSize() { 189 return super.memSize() + 1 * 4; 190 } 191 192 195 int treeSize() { 196 return 197 memSize() 198 + (this.typeName == null ? 0 : getTypeName().treeSize()) 199 + this.values.listSize(); 200 } 201 } 202 | Popular Tags |