Example usage for org.eclipse.jdt.internal.core.util Util getDeclaringTypeSignature

List of usage examples for org.eclipse.jdt.internal.core.util Util getDeclaringTypeSignature

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.util Util getDeclaringTypeSignature.

Prototype

public static String getDeclaringTypeSignature(String key) 

Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.ConstructorPattern.java

License:Open Source License

public ConstructorPattern(char[] declaringSimpleName, char[] declaringQualification,
        char[][] parameterQualifications, char[][] parameterSimpleNames, String[] parameterSignatures,
        IMethod method, int limitTo, int matchRule) {

    this(declaringSimpleName, declaringQualification, parameterQualifications, parameterSimpleNames, limitTo,
            matchRule);//w ww. ja  va 2s. c o m

    // Set flags
    try {
        this.varargs = (method.getFlags() & Flags.AccVarargs) != 0;
    } catch (JavaModelException e) {
        // do nothing
    }

    // Get unique key for parameterized constructors
    String genericDeclaringTypeSignature = null;
    if (method.isResolved()) {
        String key = method.getKey();
        BindingKey bindingKey = new BindingKey(key);
        if (bindingKey.isParameterizedType()) {
            genericDeclaringTypeSignature = Util.getDeclaringTypeSignature(key);
            // Store type signature and arguments for declaring type
            if (genericDeclaringTypeSignature != null) {
                this.typeSignatures = Util.splitTypeLevelsSignature(genericDeclaringTypeSignature);
                setTypeArguments(Util.getAllTypeArguments(this.typeSignatures));
            }
        }
    } else {
        this.constructorParameters = true;
        storeTypeSignaturesAndArguments(method.getDeclaringType());
    }

    // store type signatures and arguments for method parameters type
    if (parameterSignatures != null) {
        int length = parameterSignatures.length;
        if (length > 0) {
            this.parametersTypeSignatures = new char[length][][];
            this.parametersTypeArguments = new char[length][][][];
            for (int i = 0; i < length; i++) {
                this.parametersTypeSignatures[i] = Util.splitTypeLevelsSignature(parameterSignatures[i]);
                this.parametersTypeArguments[i] = Util.getAllTypeArguments(this.parametersTypeSignatures[i]);
            }
        }
    }

    // Store type signatures and arguments for method
    this.constructorArguments = extractMethodArguments(method);
    if (hasConstructorArguments())
        this.mustResolve = true;
}

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MethodPattern.java

License:Open Source License

public MethodPattern(char[] selector, char[] declaringQualification, char[] declaringSimpleName,
        char[] returnQualification, char[] returnSimpleName, String returnSignature,
        char[][] parameterQualifications, char[][] parameterSimpleNames, String[] parameterSignatures,
        IMethod method, int limitTo, int matchRule) {

    this(selector, declaringQualification, declaringSimpleName, returnQualification, returnSimpleName,
            parameterQualifications, parameterSimpleNames, method.getDeclaringType(), limitTo, matchRule);

    // Set flags/*from  w w  w.j a v  a2s  .  c o  m*/
    try {
        this.varargs = (method.getFlags() & Flags.AccVarargs) != 0;
    } catch (JavaModelException e) {
        // do nothing
    }

    // Get unique key for parameterized constructors
    String genericDeclaringTypeSignature = null;
    if (method.isResolved()) {
        String key = method.getKey();
        BindingKey bindingKey = new BindingKey(key);
        if (bindingKey.isParameterizedType()) {
            genericDeclaringTypeSignature = Util.getDeclaringTypeSignature(key);
            // Store type signature and arguments for declaring type
            if (genericDeclaringTypeSignature != null) {
                this.typeSignatures = Util.splitTypeLevelsSignature(genericDeclaringTypeSignature);
                setTypeArguments(Util.getAllTypeArguments(this.typeSignatures));
            }
        }
    } else {
        this.methodParameters = true;
        storeTypeSignaturesAndArguments(this.declaringType);
    }

    // Store type signatures and arguments for return type
    if (returnSignature != null) {
        this.returnTypeSignatures = Util.splitTypeLevelsSignature(returnSignature);
    }

    // Store type signatures and arguments for method parameters type
    if (parameterSignatures != null) {
        int length = parameterSignatures.length;
        if (length > 0) {
            this.parametersTypeSignatures = new char[length][][];
            this.parametersTypeArguments = new char[length][][][];
            for (int i = 0; i < length; i++) {
                this.parametersTypeSignatures[i] = Util.splitTypeLevelsSignature(parameterSignatures[i]);
                this.parametersTypeArguments[i] = Util.getAllTypeArguments(this.parametersTypeSignatures[i]);
            }
        }
    }

    // Store type signatures and arguments for method
    this.methodArguments = extractMethodArguments(method);
    if (hasMethodArguments())
        this.mustResolve = true;
}