Example usage for org.eclipse.jdt.internal.compiler.lookup TypeIds NoId

List of usage examples for org.eclipse.jdt.internal.compiler.lookup TypeIds NoId

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup TypeIds NoId.

Prototype

int NoId

To view the source code for org.eclipse.jdt.internal.compiler.lookup TypeIds NoId.

Click Source Link

Usage

From source file:org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.java

License:Open Source License

public String toString() {
    StringBuffer buffer = new StringBuffer(30);
    buffer.append("(id="); //$NON-NLS-1$
    if (this.id == TypeIds.NoId)
        buffer.append("NoId"); //$NON-NLS-1$
    else/*from   ww w.ja  va2s . c o  m*/
        buffer.append(this.id);
    buffer.append(")\n"); //$NON-NLS-1$
    if (isDeprecated())
        buffer.append("deprecated "); //$NON-NLS-1$
    if (isPublic())
        buffer.append("public "); //$NON-NLS-1$
    if (isProtected())
        buffer.append("protected "); //$NON-NLS-1$
    if (isPrivate())
        buffer.append("private "); //$NON-NLS-1$
    if (isAbstract() && isClass())
        buffer.append("abstract "); //$NON-NLS-1$
    if (isStatic() && isNestedType())
        buffer.append("static "); //$NON-NLS-1$
    if (isFinal())
        buffer.append("final "); //$NON-NLS-1$

    if (isEnum())
        buffer.append("enum "); //$NON-NLS-1$
    else if (isAnnotationType())
        buffer.append("@interface "); //$NON-NLS-1$
    else if (isClass())
        buffer.append("class "); //$NON-NLS-1$
    else
        buffer.append("interface "); //$NON-NLS-1$
    buffer.append((this.compoundName != null) ? CharOperation.toString(this.compoundName) : "UNNAMED TYPE"); //$NON-NLS-1$

    if (this.typeVariables == null) {
        buffer.append("<NULL TYPE VARIABLES>"); //$NON-NLS-1$
    } else if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
        buffer.append("<"); //$NON-NLS-1$
        for (int i = 0, length = this.typeVariables.length; i < length; i++) {
            if (i > 0)
                buffer.append(", "); //$NON-NLS-1$
            if (this.typeVariables[i] == null) {
                buffer.append("NULL TYPE VARIABLE"); //$NON-NLS-1$
                continue;
            }
            char[] varChars = this.typeVariables[i].toString().toCharArray();
            buffer.append(varChars, 1, varChars.length - 2);
        }
        buffer.append(">"); //$NON-NLS-1$
    }
    buffer.append("\n\textends "); //$NON-NLS-1$
    buffer.append((this.superclass != null) ? this.superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$

    if (this.superInterfaces != null) {
        if (this.superInterfaces != Binding.NO_SUPERINTERFACES) {
            buffer.append("\n\timplements : "); //$NON-NLS-1$
            for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
                if (i > 0)
                    buffer.append(", "); //$NON-NLS-1$
                buffer.append(
                        (this.superInterfaces[i] != null) ? this.superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
            }
        }
    } else {
        buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$
    }

    if (enclosingType() != null) {
        buffer.append("\n\tenclosing type : "); //$NON-NLS-1$
        buffer.append(enclosingType().debugName());
    }

    if (this.fields != null) {
        if (this.fields != Binding.NO_FIELDS) {
            buffer.append("\n/*   fields   */"); //$NON-NLS-1$
            for (int i = 0, length = this.fields.length; i < length; i++)
                buffer.append('\n').append((this.fields[i] != null) ? this.fields[i].toString() : "NULL FIELD"); //$NON-NLS-1$
        }
    } else {
        buffer.append("NULL FIELDS"); //$NON-NLS-1$
    }

    if (this.methods != null) {
        if (this.methods != Binding.NO_METHODS) {
            buffer.append("\n/*   methods   */"); //$NON-NLS-1$
            for (int i = 0, length = this.methods.length; i < length; i++)
                buffer.append('\n')
                        .append((this.methods[i] != null) ? this.methods[i].toString() : "NULL METHOD"); //$NON-NLS-1$
        }
    } else {
        buffer.append("NULL METHODS"); //$NON-NLS-1$
    }

    if (this.memberTypes != null) {
        if (this.memberTypes != Binding.NO_MEMBER_TYPES) {
            buffer.append("\n/*   members   */"); //$NON-NLS-1$
            for (int i = 0, length = this.memberTypes.length; i < length; i++)
                buffer.append('\n')
                        .append((this.memberTypes[i] != null) ? this.memberTypes[i].toString() : "NULL TYPE"); //$NON-NLS-1$
        }
    } else {
        buffer.append("NULL MEMBER TYPES"); //$NON-NLS-1$
    }

    buffer.append("\n\n"); //$NON-NLS-1$
    return buffer.toString();
}