1 11 package org.eclipse.jdt.core.dom; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 45 public class AnnotationTypeDeclaration extends AbstractTypeDeclaration { 46 47 50 public static final ChildPropertyDescriptor JAVADOC_PROPERTY = 51 internalJavadocPropertyFactory(AnnotationTypeDeclaration.class); 52 53 56 public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = 57 internalModifiers2PropertyFactory(AnnotationTypeDeclaration.class); 58 59 62 public static final ChildPropertyDescriptor NAME_PROPERTY = 63 internalNamePropertyFactory(AnnotationTypeDeclaration.class); 64 65 68 public static final ChildListPropertyDescriptor BODY_DECLARATIONS_PROPERTY = 69 internalBodyDeclarationPropertyFactory(AnnotationTypeDeclaration.class); 70 71 76 private static final List PROPERTY_DESCRIPTORS; 77 78 static { 79 List properyList = new ArrayList (5); 80 createPropertyList(AnnotationTypeDeclaration.class, properyList); 81 addProperty(JAVADOC_PROPERTY, properyList); 82 addProperty(MODIFIERS2_PROPERTY, properyList); 83 addProperty(NAME_PROPERTY, properyList); 84 addProperty(BODY_DECLARATIONS_PROPERTY, properyList); 85 PROPERTY_DESCRIPTORS = reapPropertyList(properyList); 86 } 87 88 98 public static List propertyDescriptors(int apiLevel) { 99 return PROPERTY_DESCRIPTORS; 100 } 101 102 115 AnnotationTypeDeclaration(AST ast) { 116 super(ast); 117 unsupportedIn2(); 118 } 119 120 123 final List internalStructuralPropertiesForType(int apiLevel) { 124 return propertyDescriptors(apiLevel); 125 } 126 127 130 final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { 131 if (property == JAVADOC_PROPERTY) { 132 if (get) { 133 return getJavadoc(); 134 } else { 135 setJavadoc((Javadoc) child); 136 return null; 137 } 138 } 139 if (property == NAME_PROPERTY) { 140 if (get) { 141 return getName(); 142 } else { 143 setName((SimpleName) child); 144 return null; 145 } 146 } 147 return super.internalGetSetChildProperty(property, get, child); 149 } 150 151 154 final List internalGetChildListProperty(ChildListPropertyDescriptor property) { 155 if (property == MODIFIERS2_PROPERTY) { 156 return modifiers(); 157 } 158 if (property == BODY_DECLARATIONS_PROPERTY) { 159 return bodyDeclarations(); 160 } 161 return super.internalGetChildListProperty(property); 163 } 164 165 168 final ChildPropertyDescriptor internalJavadocProperty() { 169 return JAVADOC_PROPERTY; 170 } 171 172 175 final ChildListPropertyDescriptor internalModifiers2Property() { 176 return MODIFIERS2_PROPERTY; 177 } 178 179 182 final SimplePropertyDescriptor internalModifiersProperty() { 183 return null; 185 } 186 187 190 final ChildPropertyDescriptor internalNameProperty() { 191 return NAME_PROPERTY; 192 } 193 194 197 final ChildListPropertyDescriptor internalBodyDeclarationsProperty() { 198 return BODY_DECLARATIONS_PROPERTY; 199 } 200 201 204 final int getNodeType0() { 205 return ANNOTATION_TYPE_DECLARATION; 206 } 207 208 211 ASTNode clone0(AST target) { 212 AnnotationTypeDeclaration result = new AnnotationTypeDeclaration(target); 213 result.setSourceRange(this.getStartPosition(), this.getLength()); 214 result.setJavadoc( 215 (Javadoc) ASTNode.copySubtree(target, getJavadoc())); 216 result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers())); 217 result.setName((SimpleName) getName().clone(target)); 218 result.bodyDeclarations().addAll(ASTNode.copySubtrees(target, bodyDeclarations())); 219 return result; 220 } 221 222 225 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 226 return matcher.match(this, other); 228 } 229 230 233 void accept0(ASTVisitor visitor) { 234 boolean visitChildren = visitor.visit(this); 235 if (visitChildren) { 236 acceptChild(visitor, getJavadoc()); 238 acceptChildren(visitor, this.modifiers); 239 acceptChild(visitor, getName()); 240 acceptChildren(visitor, this.bodyDeclarations); 241 } 242 visitor.endVisit(this); 243 } 244 245 248 ITypeBinding internalResolveBinding() { 249 return this.ast.getBindingResolver().resolveType(this); 250 } 251 252 255 int memSize() { 256 return super.memSize(); 257 } 258 259 262 int treeSize() { 263 return 264 memSize() 265 + (this.optionalDocComment == null ? 0 : getJavadoc().treeSize()) 266 + this.modifiers.listSize() 267 + (this.typeName == null ? 0 : getName().treeSize()) 268 + this.bodyDeclarations.listSize(); 269 } 270 } 271 272 | Popular Tags |