Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2003, 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;

Type node for a wildcard type (added in JLS3 API).
 WildcardType:
    ? [ ( extends | super) Type ]
 

Not all node arrangements will represent legal Java constructs. In particular, it is nonsense if a wildcard type node appears anywhere other than as an argument of a ParameterizedType node.

Since:
3.1
Noinstantiate:
This class is not intended to be instantiated by clients.
 
 public class WildcardType extends Type {

The "bound" structural property of this node type (child type: Type).
 
 	public static final ChildPropertyDescriptor BOUND_PROPERTY =
 		new ChildPropertyDescriptor(WildcardType.class"bound"Type.class); //$NON-NLS-1$
 
The "upperBound" structural property of this node type (type: java.lang.Boolean).
 
 	public static final SimplePropertyDescriptor UPPER_BOUND_PROPERTY =
 		new SimplePropertyDescriptor(WildcardType.class"upperBound"boolean.class); //$NON-NLS-1$
 
A list of property descriptors (element type: StructuralPropertyDescriptor), or null if uninitialized.
 
 	private static final List PROPERTY_DESCRIPTORS;
 
 	static {
 		List propertyList = new ArrayList(3);
 		createPropertyList(WildcardType.classpropertyList);
 		addProperty(propertyList);
 	}

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)
 
 	public static List propertyDescriptors(int apiLevel) {
 	}

The optional type bound node; null if none; defaults to none.
 
 	private Type optionalBound = null;

Indicates whether the wildcard bound is an upper bound ("extends") as opposed to a lower bound ("super"). Defaults to true initially.
 
 	private boolean isUpperBound = true;

Creates a new unparented node for a wildcard type owned by the given AST. By default, no upper bound.

N.B. This constructor is package-private.

Parameters:
ast the AST that is to own this node
 
 	WildcardType(AST ast) {
 		super(ast);
 	    unsupportedIn2();
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	final List internalStructuralPropertiesForType(int apiLevel) {
		return propertyDescriptors(apiLevel);
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	final boolean internalGetSetBooleanProperty(SimplePropertyDescriptor propertyboolean getboolean value) {
		if (property == ) {
			if (get) {
				return isUpperBound();
else {
				return false;
			}
		}
		// allow default implementation to flag the error
		return super.internalGetSetBooleanProperty(propertygetvalue);
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor propertyboolean getASTNode child) {
		if (property == ) {
			if (get) {
				return getBound();
else {
				setBound((Typechild);
				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) {
		WildcardType result = new WildcardType(target);
		result.setBound((Type) ASTNode.copySubtree(targetgetBound()), isUpperBound());
		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) {
			// visit children in normal left to right reading order
			acceptChild(visitorgetBound());
		}
		visitor.endVisit(this);
	}

Returns whether this wildcard type is an upper bound ("extends") as opposed to a lower bound ("super").

Note that this property is irrelevant for wildcards that do not have a bound.

Returns:
true if an upper bound, and false if a lower bound
See also:
setBound(org.eclipse.jdt.core.dom.Type)
	public boolean isUpperBound() {
		return this.;
	}

Returns the bound of this wildcard type if it has one. If isUpperBound returns true, this is an upper bound ("? extends B"); if it returns false, this is a lower bound ("? super B").

Returns:
the bound of this wildcard type, or null if none
See also:
setBound(org.eclipse.jdt.core.dom.Type)
	public Type getBound() {
		return this.;
	}

Sets the bound of this wildcard type to the given type and marks it as an upper or a lower bound. The method is equivalent to calling setBound(type); setUpperBound(isUpperBound).

Parameters:
type the new bound of this wildcard type, or null if none
isUpperBound true for an upper bound ("? extends B"), and false for a lower bound ("? super B")
Throws:
java.lang.IllegalArgumentException if:
  • the node belongs to a different AST
  • the node already has a parent
See also:
getBound()
isUpperBound()
	public void setBound(Type typeboolean isUpperBound) {
		setBound(type);
		setUpperBound(isUpperBound);
	}

Sets the bound of this wildcard type to the given type.

Parameters:
type the new bound of this wildcard type, or null if none
Throws:
java.lang.IllegalArgumentException if:
  • the node belongs to a different AST
  • the node already has a parent
See also:
getBound()
	public void setBound(Type type) {
		ASTNode oldChild = this.;
		preReplaceChild(oldChildtype);
		this. = type;
		postReplaceChild(oldChildtype);
	}

Sets whether this wildcard type is an upper bound ("extends") as opposed to a lower bound ("super").

Parameters:
isUpperBound true if an upper bound, and false if a lower bound
See also:
isUpperBound()
	public void setUpperBound(boolean isUpperBound) {
		this. = isUpperBound;
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	int memSize() {
		return  + 2 * 4;
	}
	/* (omit javadoc for this method)
	 * Method declared on ASTNode.
	 */
	int treeSize() {
		return
		+ (this. == null ? 0 : getBound().treeSize());
	}
New to GrepCode? Check out our FAQ X