/******************************************************************************* * 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 net.sourceforge.phpdt.core.dom; /** * Abstract base class for property descriptors of AST nodes. * There are three kinds of properties: *
* For example, for all properties of the node type
* TypeDeclaration, this method returns TypeDeclaration.class
.
*
true
if this is a simple property, and
* false
otherwise
*/
public final boolean isSimpleProperty(){
return (this instanceof SimplePropertyDescriptor);
}
/**
* Returns whether this property is a child property
* (instance of {@link ChildPropertyDescriptor}.
*
* @return true
if this is a child property, and
* false
otherwise
*/
public final boolean isChildProperty() {
return (this instanceof ChildPropertyDescriptor);
}
/**
* Returns whether this property is a child list property
* (instance of {@link ChildListPropertyDescriptor}.
*
* @return true
if this is a child list property, and
* false
otherwise
*/
public final boolean isChildListProperty() {
return (this instanceof ChildListPropertyDescriptor);
}
/**
* Returns a string suitable for debug purposes.
* @return {@inheritDoc}
*/
public String toString() {
StringBuffer b = new StringBuffer();
if (isChildListProperty()) {
b.append("ChildList"); //$NON-NLS-1$
}
if (isChildProperty()) {
b.append("Child"); //$NON-NLS-1$
}
if (isSimpleProperty()) {
b.append("Simple"); //$NON-NLS-1$
}
b.append("Property["); //$NON-NLS-1$
if (this.nodeClass != null) {
b.append(this.nodeClass.getName());
}
b.append(","); //$NON-NLS-1$
if (this.propertyId != null) {
b.append(this.propertyId);
}
b.append("]"); //$NON-NLS-1$
return b.toString();
}
}