Example usage for org.eclipse.jdt.internal.compiler.ast ASTNode printModifiers

List of usage examples for org.eclipse.jdt.internal.compiler.ast ASTNode printModifiers

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast ASTNode printModifiers.

Prototype

public static StringBuffer printModifiers(int modifiers, StringBuffer output) 

Source Link

Usage

From source file:com.google.devtools.j2cpp.types.GeneratedMethodBinding.java

License:Open Source License

@Override
public String toString() {
    StringBuffer sb = new StringBuffer();
    ASTNode.printModifiers(modifiers, sb);
    sb.append(returnType != null ? returnType.getName() : "<no type>");
    sb.append(' ');
    sb.append((name != null) ? name : "<no name>");
    sb.append('(');
    ITypeBinding[] params = getParameterTypes();
    for (int i = 0; i < params.length; i++) {
        sb.append(params[i].getName());/*from w  w  w  .ja va  2s  .c  o m*/
        if ((i + 1) < params.length) {
            sb.append(", ");
        }
    }
    sb.append(')');
    return sb.toString();
}

From source file:com.google.devtools.j2cpp.types.GeneratedVariableBinding.java

License:Open Source License

@Override
public String toString() {
    StringBuffer sb = new StringBuffer();
    ASTNode.printModifiers(modifiers, sb);
    sb.append(type != null ? type.getName() : "<no type>");
    sb.append(" ");
    sb.append((name != null) ? name : "<no name>");
    return sb.toString();
}

From source file:org.codehaus.groovy.eclipse.codeassist.processors.NewMethodCompletionProcessor.java

License:Apache License

private void createMethod(MethodNode method, StringBuffer completion) {
    //// Modifiers
    // flush uninteresting modifiers
    int insertedModifiers = method.getModifiers()
            & ~(Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_PUBLIC);
    ASTNode.printModifiers(insertedModifiers, completion);

    //// Type parameters
    // ignore too difficult and not really needed for Groovy

    //        GenericsType[] typeVariableBindings = method.getGenericsTypes();
    //        if(typeVariableBindings != null && typeVariableBindings.length != 0) {
    //            completion.append('<');
    //            for (int i = 0; i < typeVariableBindings.length; i++) {
    //                if(i != 0) {
    //                    completion.append(',');
    //                    completion.append(' ');
    //                }
    //                createTypeVariable(typeVariableBindings[i], completion);
    //            }
    //            completion.append('>');
    //            completion.append(' ');
    //        }//w  w  w. ja  v  a 2  s  .com

    //// Return type
    createType(method.getReturnType(), completion, false);
    completion.append(' ');

    //// Selector
    completion.append(method.getName());

    completion.append('(');

    ////Parameters
    Parameter[] parameters = method.getParameters();
    int length = parameters.length;
    for (int i = 0; i < length; i++) {
        if (i != 0) {
            completion.append(',');
            completion.append(' ');
        }
        createType(parameters[i].getType(), completion, true);
        completion.append(' ');
        completion.append(parameters[i].getName());
    }

    completion.append(')');

    //// Exceptions
    ClassNode[] exceptions = method.getExceptions();

    if (exceptions != null && exceptions.length > 0) {
        completion.append(' ');
        completion.append("throws");
        completion.append(' ');
        for (int i = 0; i < exceptions.length; i++) {
            if (i != 0) {
                completion.append(' ');
                completion.append(',');
            }
            createType(exceptions[i], completion, false);
        }
    }
}