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

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

Introduction

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

Prototype

public static String createIntersectionTypeSignature(String[] typeSignatures) 

Source Link

Document

Creates a new intersection type signature from the given type signatures.

Usage

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

License:Open Source License

public static String typeSignature(TypeReference type) {
    String signature = null;//from w w w.  j  a  va  2s. c o m
    if ((type.bits & ASTNode.IsUnionType) != 0) {
        // special treatment for union type reference
        UnionTypeReference unionTypeReference = (UnionTypeReference) type;
        TypeReference[] typeReferences = unionTypeReference.typeReferences;
        int length = typeReferences.length;
        String[] typeSignatures = new String[length];
        for (int i = 0; i < length; i++) {
            char[][] compoundName = typeReferences[i].getParameterizedTypeName();
            char[] typeName = CharOperation.concatWith(compoundName, '.');
            typeSignatures[i] = Signature.createTypeSignature(typeName, false/*
                                                                             * don 't resolve
                                                                             */);
        }
        signature = Signature.createIntersectionTypeSignature(typeSignatures);
    } else {
        char[][] compoundName = type.getParameterizedTypeName();
        char[] typeName = CharOperation.concatWith(compoundName, '.');
        signature = Signature.createTypeSignature(typeName, false/*
                                                                 * don't resolve
                                                                 */);
    }
    return signature;
}