diff options
Diffstat (limited to 'bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/dom/AbstractTypeDeclaration.java')
-rw-r--r-- | bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/dom/AbstractTypeDeclaration.java | 242 |
1 files changed, 0 insertions, 242 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/dom/AbstractTypeDeclaration.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/dom/AbstractTypeDeclaration.java deleted file mode 100644 index 9fe8daae..00000000 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/dom/AbstractTypeDeclaration.java +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.dom; - -import java.util.List; - -/** - * Abstract subclass for type declaration AST node types. - * - * Provisional API: This class/interface is part of an interim API that is still under development and expected to - * change significantly before reaching stability. It is being made available at this early stage to solicit feedback - * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken - * (repeatedly) as the API evolves. - */ -public abstract class AbstractTypeDeclaration extends BodyDeclaration { - - - /** - * The type name; lazily initialized; defaults to a unspecified, - * legal JavaScript class identifier. - */ - SimpleName typeName = null; - - /** - * The body declarations (element type: <code>BodyDeclaration</code>). - * Defaults to an empty list. - */ - ASTNode.NodeList bodyDeclarations; - - /** - * Returns structural property descriptor for the "bodyDeclarations" property - * of this node. - * - * @return the property descriptor - */ - abstract ChildListPropertyDescriptor internalBodyDeclarationsProperty(); - - /** - * Returns structural property descriptor for the "bodyDeclarations" property - * of this node. - * - * @return the property descriptor - */ - public final ChildListPropertyDescriptor getBodyDeclarationsProperty() { - return internalBodyDeclarationsProperty(); - } - - /** - * Returns structural property descriptor for the "name" property - * of this node. - * - * @return the property descriptor - */ - abstract ChildPropertyDescriptor internalNameProperty(); - - /** - * Returns structural property descriptor for the "name" property - * of this node. - * - * @return the property descriptor - */ - public final ChildPropertyDescriptor getNameProperty() { - return internalNameProperty(); - } - - /** - * Creates and returns a structural property descriptor for the - * "bodyDeclaration" property declared on the given concrete node type. - * - * @return the property descriptor - */ - static final ChildListPropertyDescriptor internalBodyDeclarationPropertyFactory(Class nodeClass) { - return new ChildListPropertyDescriptor(nodeClass, "bodyDeclarations", BodyDeclaration.class, CYCLE_RISK); //$NON-NLS-1$ - } - - /** - * Creates and returns a structural property descriptor for the - * "name" property declared on the given concrete node type. - * - * @return the property descriptor - */ - static final ChildPropertyDescriptor internalNamePropertyFactory(Class nodeClass) { - return new ChildPropertyDescriptor(nodeClass, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ - } - - /** - * Creates a new AST node for an abstract type declaration owned by the given - * AST. - * <p> - * N.B. This constructor is package-private; all subclasses must be - * declared in the same package; clients are unable to declare - * additional subclasses. - * </p> - * - * @param ast the AST that is to own this node - */ - AbstractTypeDeclaration(AST ast) { - super(ast); - this.bodyDeclarations = new ASTNode.NodeList(internalBodyDeclarationsProperty()); - } - - /** - * Returns the name of the type declared in this type declaration. - * - * @return the type name node - */ - public SimpleName getName() { - if (this.typeName == null) { - // lazy init must be thread-safe for readers - synchronized (this) { - if (this.typeName == null) { - preLazyInit(); - this.typeName = new SimpleName(this.ast); - postLazyInit(this.typeName, internalNameProperty()); - } - } - } - return this.typeName; - } - - /** - * Sets the name of the type declared in this type declaration to the - * given name. - * - * @param typeName the new type name - * @exception IllegalArgumentException if: - * <ul> - * <li>the node belongs to a different AST</li> - * <li>the node already has a parent</li> - * </ul> - */ - public void setName(SimpleName typeName) { - if (typeName == null) { - throw new IllegalArgumentException(); - } - ChildPropertyDescriptor p = internalNameProperty(); - ASTNode oldChild = this.typeName; - preReplaceChild(oldChild, typeName, p); - this.typeName = typeName; - postReplaceChild(oldChild, typeName, p); - } - - /** - * Returns the live ordered list of body declarations of this type - * declaration. - * - * @return the live list of body declarations - * (element type: <code>BodyDeclaration</code>) - */ - public List bodyDeclarations() { - return this.bodyDeclarations; - } - - /** - * Returns whether this type declaration is a package member (that is, - * a top-level type). - * <p> - * Note that this is a convenience method that simply checks whether - * this node's parent is a javaScript unit node. - * </p> - * - * @return <code>true</code> if this type declaration is a child of - * a javaScript unit node, and <code>false</code> otherwise - */ - public boolean isPackageMemberTypeDeclaration() { - ASTNode parent = getParent(); - return (parent instanceof JavaScriptUnit); - } - - /** - * Returns whether this type declaration is a type member. - * <p> - * Note that this is a convenience method that simply checks whether - * this node's parent is a type declaration node or an anonymous - * class declaration. - * </p> - * - * @return <code>true</code> if this type declaration is a child of - * a type declaration node or an anonymous class declaration node, - * and <code>false</code> otherwise - */ - public boolean isMemberTypeDeclaration() { - ASTNode parent = getParent(); - return (parent instanceof AbstractTypeDeclaration) - || (parent instanceof AnonymousClassDeclaration); - } - - /** - * Returns whether this type declaration is a local type. - * <p> - * Note that this is a convenience method that simply checks whether - * this node's parent is a type declaration statement node. - * </p> - * - * @return <code>true</code> if this type declaration is a child of - * a type declaration statement node, and <code>false</code> otherwise - */ - public boolean isLocalTypeDeclaration() { - ASTNode parent = getParent(); - return (parent instanceof TypeDeclarationStatement); - } - - /** - * Resolves and returns the binding for the type declared in this type - * declaration. - * <p> - * Note that bindings are generally unavailable unless requested when the - * AST is being built. - * </p> - * - * @return the binding, or <code>null</code> if the binding cannot be - * resolved - */ - public final ITypeBinding resolveBinding() { - return internalResolveBinding(); - } - - /** - * Resolves and returns the binding for the type declared in this type - * declaration. This method must be implemented by subclasses. - * - * @return the binding, or <code>null</code> if the binding cannot be - * resolved - */ - abstract ITypeBinding internalResolveBinding(); - - /* (omit jsdoc for this method) - * Method declared on ASTNode. - */ - int memSize() { - return super.memSize() + 2 * 4; - } - -} |