Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2010 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.jdt.core.dom;
 
 import java.util.List;

Local type declaration statement AST node type.

This kind of node is used to convert a type declaration node into a statement node by wrapping it.

For JLS2:
 TypeDeclarationStatement:
    TypeDeclaration
 
For JLS3, the kinds of type declarations grew to include enum declarations:
 TypeDeclarationStatement:
    TypeDeclaration
    EnumDeclaration
 
Although allowed at the AST, not all arrangements of AST nodes are meaningful; in particular, only class and enum declarations are meaningful in the context of a block.

Since:
2.0
Noinstantiate:
This class is not intended to be instantiated by clients.
 
 public class TypeDeclarationStatement extends Statement {

The "typeDeclaration" structural property of this node type (child type: TypeDeclaration) (JLS2 API only).

Since:
3.0
 
 		new ChildPropertyDescriptor(TypeDeclarationStatement.class"typeDeclaration"TypeDeclaration.class); //$NON-NLS-1$
 
The "declaration" structural property of this node type (child type: AbstractTypeDeclaration) (added in JLS3 API).

Since:
3.1
 
 	public static final ChildPropertyDescriptor DECLARATION_PROPERTY =
 		new ChildPropertyDescriptor(TypeDeclarationStatement.class"declaration"AbstractTypeDeclaration.class); //$NON-NLS-1$
 
A list of property descriptors (element type: StructuralPropertyDescriptor), or null if uninitialized.

Since:
3.0
 
 	private static final List PROPERTY_DESCRIPTORS_2_0;

A list of property descriptors (element type: StructuralPropertyDescriptor), or null if uninitialized.

Since:
3.1
 
 	private static final List PROPERTY_DESCRIPTORS_3_0;
 
 	static {
 		List propertyList = new ArrayList(2);
 
 		propertyList = new ArrayList(2);
 	}

Returns a list of structural property descriptors for this node type. Clients must not modify the result.

Parameters:
apiLevel the API level; one of the AST.JLS* constants
Returns:
a list of property descriptors (element type: StructuralPropertyDescriptor)
Since:
3.0
 
 	public static List propertyDescriptors(int apiLevel) {
 		if (apiLevel == .) {
 		} else {
		}
	}

The type declaration; lazily initialized; defaults to a unspecified, but legal, type declaration. In JLS2, corresponds to TYPE_DECLARATION_PROPERTY. After JLS2, corresponds to DECLARATION_PROPERTY.

	private AbstractTypeDeclaration typeDecl = null;

    
The child property stored on the typeDecl instance variable. In JLS2, corresponds to TYPE_DECLARATION_PROPERTY. After JLS2, corresponds to DECLARATION_PROPERTY.

Returns:
the property corresponding to the typeDecl instance variable; never null
        if (getAST().apiLevel() == .) {
            return ;
        } else {
            return ;
        }
    }


Creates a new unparented local type declaration statement node owned by the given AST. By default, the local type declaration is an unspecified, but legal, type declaration.

N.B. This constructor is package-private.

Parameters:
ast the AST that is to own this node
		super(ast);
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 * @since 3.0
	 */
	final List internalStructuralPropertiesForType(int apiLevel) {
		return propertyDescriptors(apiLevel);
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor propertyboolean getASTNode child) {
		if (property == ) {
			if (get) {
else {
				return null;
			}
		}
		if (property == ) {
			if (get) {
				return getDeclaration();
else {
				return null;
			}
		}
		// allow default implementation to flag the error
		return super.internalGetSetChildProperty(propertygetchild);
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	final int getNodeType0() {
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	ASTNode clone0(AST target) {
		result.copyLeadingComment(this);
		return result;
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	final boolean subtreeMatch0(ASTMatcher matcherObject other) {
		// dispatch to correct overloaded match method
		return matcher.match(thisother);
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	void accept0(ASTVisitor visitor) {
		boolean visitChildren = visitor.visit(this);
		if (visitChildren) {
		}
		visitor.endVisit(this);
	}

Returns the abstract type declaration of this local type declaration statement (added in JLS3 API).

Returns:
the type declaration node
Since:
3.1
		if (this. == null) {
			// lazy init must be thread-safe for readers
			synchronized (this) {
				if (this. == null) {
					this. = new TypeDeclaration(this.);
				}
			}
		}
		return this.;
	}

Sets the abstract type declaration of this local type declaration statement (added in JLS3 API).

Parameters:
decl the type declaration node
Throws:
java.lang.IllegalArgumentException if:
  • the node belongs to a different AST
  • the node already has a parent
  • a cycle in would be created
Since:
3.1
		if (decl == null) {
		}
		// a TypeDeclarationStatement may occur inside an
		// TypeDeclaration - must check cycles
		ASTNode oldChild = this.;
		preReplaceChild(oldChilddecltypeDeclProperty);
		this.decl;
		postReplaceChild(oldChilddecltypeDeclProperty);
	}

Returns the type declaration of this local type declaration statement (JLS2 API only).

Deprecated:
In the JLS3 API, this method is replaced by getDeclaration(), which returns AbstractTypeDeclaration instead of TypeDeclaration.
Returns:
the type declaration node
Throws:
java.lang.UnsupportedOperationException if this operation is used in an AST later than JLS2
	}

Internal synonym for deprecated method. Used to avoid deprecation warnings.

Since:
3.1
	}

Sets the type declaration of this local type declaration statement (JLS2 API only).

Deprecated:
In the JLS3 API, this method is replaced by setDeclaration(org.eclipse.jdt.core.dom.AbstractTypeDeclaration) which takes AbstractTypeDeclaration instead of TypeDeclaration.
Parameters:
decl the type declaration node
Throws:
java.lang.IllegalArgumentException if:
  • the node belongs to a different AST
  • the node already has a parent
  • a cycle in would be created
java.lang.UnsupportedOperationException if this operation is used in an AST later than JLS2
	public void setTypeDeclaration(TypeDeclaration decl) {
	}

Internal synonym for deprecated method. Used to avoid deprecation warnings.

Since:
3.1
	/*package*/ final void internalSetTypeDeclaration(TypeDeclaration decl) {
		// forward to non-deprecated replacement method
	}

Resolves and returns the binding for the class or interface declared in this type declaration statement.

Note that bindings are generally unavailable unless requested when the AST is being built.

Returns:
the binding, or null if the binding cannot be resolved
		// forward request to the wrapped type declaration
		if (d instanceof TypeDeclaration) {
else if (d instanceof AnnotationTypeDeclaration) {
else {
			// shouldn't happen
			return null;
		}
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	int memSize() {
		return super.memSize() + 1 * 4;
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	int treeSize() {
		return
			+ (this. == null ? 0 : getDeclaration().treeSize());
	}
New to GrepCode? Check out our FAQ X