1 11 package org.eclipse.jdt.core.dom; 12 13 import java.util.List ; 14 15 27 public abstract class AbstractTypeDeclaration extends BodyDeclaration { 28 29 34 SimpleName typeName = null; 35 36 41 ASTNode.NodeList bodyDeclarations; 42 43 49 abstract ChildListPropertyDescriptor internalBodyDeclarationsProperty(); 50 51 58 public final ChildListPropertyDescriptor getBodyDeclarationsProperty() { 59 return internalBodyDeclarationsProperty(); 60 } 61 62 68 abstract ChildPropertyDescriptor internalNameProperty(); 69 70 77 public final ChildPropertyDescriptor getNameProperty() { 78 return internalNameProperty(); 79 } 80 81 87 static final ChildListPropertyDescriptor internalBodyDeclarationPropertyFactory(Class nodeClass) { 88 return new ChildListPropertyDescriptor(nodeClass, "bodyDeclarations", BodyDeclaration.class, CYCLE_RISK); } 90 91 97 static final ChildPropertyDescriptor internalNamePropertyFactory(Class nodeClass) { 98 return new ChildPropertyDescriptor(nodeClass, "name", Name.class, MANDATORY, NO_CYCLE_RISK); } 100 101 112 AbstractTypeDeclaration(AST ast) { 113 super(ast); 114 this.bodyDeclarations = new ASTNode.NodeList(internalBodyDeclarationsProperty()); 115 } 116 117 123 public SimpleName getName() { 124 if (this.typeName == null) { 125 synchronized (this) { 127 if (this.typeName == null) { 128 preLazyInit(); 129 this.typeName = new SimpleName(this.ast); 130 postLazyInit(this.typeName, internalNameProperty()); 131 } 132 } 133 } 134 return this.typeName; 135 } 136 137 149 public void setName(SimpleName typeName) { 150 if (typeName == null) { 151 throw new IllegalArgumentException (); 152 } 153 ChildPropertyDescriptor p = internalNameProperty(); 154 ASTNode oldChild = this.typeName; 155 preReplaceChild(oldChild, typeName, p); 156 this.typeName = typeName; 157 postReplaceChild(oldChild, typeName, p); 158 } 159 160 168 public List bodyDeclarations() { 169 return this.bodyDeclarations; 170 } 171 172 184 public boolean isPackageMemberTypeDeclaration() { 185 ASTNode parent = getParent(); 186 return (parent instanceof CompilationUnit); 187 } 188 189 202 public boolean isMemberTypeDeclaration() { 203 ASTNode parent = getParent(); 204 return (parent instanceof AbstractTypeDeclaration) 205 || (parent instanceof AnonymousClassDeclaration); 206 } 207 208 219 public boolean isLocalTypeDeclaration() { 220 ASTNode parent = getParent(); 221 return (parent instanceof TypeDeclarationStatement); 222 } 223 224 236 public final ITypeBinding resolveBinding() { 237 return internalResolveBinding(); 238 } 239 240 247 abstract ITypeBinding internalResolveBinding(); 248 249 252 int memSize() { 253 return super.memSize() + 2 * 4; 254 } 255 256 } 257 | Popular Tags |