<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . core . util . KeyKind ; import org . eclipse . jdt . internal . core . util . KeyToSignature ; public final class BindingKey { private String key ; public BindingKey ( String key ) { this . key = key ; } public static String createArrayTypeBindingKey ( String typeKey , int arrayDimension ) { StringBuffer buffer = new StringBuffer ( ) ; while ( arrayDimension -- > 0 ) buffer . append ( '[' ) ; buffer . append ( typeKey ) ; return buffer . toString ( ) ; } public static String createParameterizedTypeBindingKey ( String genericTypeKey , String [ ] argumentTypeKeys ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( Signature . getTypeErasure ( genericTypeKey ) ) ; buffer . insert ( buffer . length ( ) - 1 , '<' ) ; for ( int i = 0 , length = argumentTypeKeys . length ; i < length ; i ++ ) { String argumentTypeKey = argumentTypeKeys [ i ] ; buffer . insert ( buffer . length ( ) - 1 , argumentTypeKey ) ; } buffer . insert ( buffer . length ( ) - 1 , '>' ) ; return buffer . toString ( ) ; } public static String createTypeBindingKey ( String typeName ) { return Signature . createTypeSignature ( typeName . replace ( '.' , '/' ) , true ) ; } public static String createTypeVariableBindingKey ( String typeVariableName , String declaringKey ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( declaringKey ) ; buffer . append ( ':' ) ; buffer . append ( 'T' ) ; buffer . append ( typeVariableName ) ; buffer . append ( ';' ) ; return buffer . toString ( ) ; } public static String createWilcardTypeBindingKey ( String typeKey , char kind ) { switch ( kind ) { case Signature . C_STAR : return "*" ; case Signature . C_SUPER : return '-' + typeKey ; case Signature . C_EXTENDS : return '+' + typeKey ; } return null ; } public static String createWildcardTypeBindingKey ( String genericTypeKey , char boundKind , String boundTypeKey , int rank ) { String wildCardKey ; switch ( boundKind ) { case Signature . C_STAR : wildCardKey = new String ( TypeConstants . WILDCARD_STAR ) ; break ; case Signature . C_SUPER : wildCardKey = new String ( TypeConstants . WILDCARD_MINUS ) + boundTypeKey ; break ; case Signature . C_EXTENDS : wildCardKey = new String ( TypeConstants . WILDCARD_PLUS ) + boundTypeKey ; break ; default : return null ; } return genericTypeKey + '{' + rank + '}' + wildCardKey ; } public String [ ] getThrownExceptions ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . THROWN_EXCEPTIONS ) ; keyToSignature . parse ( ) ; return keyToSignature . getThrownExceptions ( ) ; } public String [ ] getTypeArguments ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . TYPE_ARGUMENTS ) ; keyToSignature . parse ( ) ; return keyToSignature . getTypeArguments ( ) ; } public boolean isRawType ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_RAW_TYPE ) != 0 ; } public boolean isParameterizedType ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_PARAMETERIZED_TYPE ) != 0 ; } public boolean isParameterizedMethod ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_PARAMETERIZED_METHOD ) != 0 ; } public String toSignature ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . SIGNATURE ) ; keyToSignature . parse ( ) ; return keyToSignature . signature . toString ( ) ; } public String toString ( ) { return this . key ; } } </s>