Example usage for org.eclipse.jdt.core Signature C_PARAM_START

List of usage examples for org.eclipse.jdt.core Signature C_PARAM_START

Introduction

In this page you can find the example usage for org.eclipse.jdt.core Signature C_PARAM_START.

Prototype

char C_PARAM_START

To view the source code for org.eclipse.jdt.core Signature C_PARAM_START.

Click Source Link

Document

Character constant indicating the start of a parameter type list in a signature.

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.util.Util.java

License:Open Source License

public static char[] toAnchor(int startingIndex, char[] methodSignature, char[] methodName,
        boolean isVargArgs) {
    int firstParen = CharOperation.indexOf(Signature.C_PARAM_START, methodSignature);
    if (firstParen == -1) {
        throw new IllegalArgumentException();
    }/*w w  w  .  j a v  a  2 s. c  o m*/

    StringBuffer buffer = new StringBuffer(methodSignature.length + 10);

    // selector
    if (methodName != null) {
        buffer.append(methodName);
    }

    // parameters
    buffer.append('(');
    char[][] pts = Signature.getParameterTypes(methodSignature);
    for (int i = startingIndex, max = pts.length; i < max; i++) {
        if (i == max - 1) {
            appendTypeSignatureForAnchor(pts[i], 0, buffer, isVargArgs);
        } else {
            appendTypeSignatureForAnchor(pts[i], 0, buffer, false);
        }
        if (i != pts.length - 1) {
            buffer.append(',');
            buffer.append(' ');
        }
    }
    buffer.append(')');
    char[] result = new char[buffer.length()];
    buffer.getChars(0, buffer.length(), result, 0);
    return result;
}

From source file:org.eclipse.jst.jsf.common.internal.types.TypeUtil.java

License:Open Source License

/**
 * @param signature// w  w  w . ja  va 2  s .com
 * @return true if the signature is a method signature
 */
public static boolean isMethodSignature(final String signature) {
    // method signature must start with a "("
    return signature.charAt(0) == Signature.C_PARAM_START;
}