org.eclipse.wst.jsdt.core
Class BindingKey

java.lang.Object
  extended by org.eclipse.wst.jsdt.core.BindingKey

public final class BindingKey
extends java.lang.Object

Utility class to decode or create a binding key.

This class is not intended to be subclassed by clients.

See Also:
Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Constructor Summary
BindingKey(java.lang.String key)
          Creates a new binding key.
 
Method Summary
static java.lang.String createArrayTypeBindingKey(java.lang.String typeKey, int arrayDimension)
          Creates a new array type binding key from the given type binding key and the given array dimension.
static java.lang.String createParameterizedTypeBindingKey(java.lang.String genericTypeKey, java.lang.String[] argumentTypeKeys)
          Creates a new parameterized type binding key from the given generic type binding key and the given argument type binding keys.
static java.lang.String createTypeBindingKey(java.lang.String typeName)
          Creates a new type binding key from the given type name.
static java.lang.String createTypeVariableBindingKey(java.lang.String typeVariableName, java.lang.String declaringKey)
          Creates a new type variable binding key from the given type variable name and the given declaring key.
static java.lang.String createWilcardTypeBindingKey(java.lang.String typeKey, char kind)
          Creates a new wildcard type binding key from the given type binding key and the given wildcard kind (one of Signature.C_STAR, Signature.C_SUPER, or Signature.C_EXTENDS.
 java.lang.String[] getThrownExceptions()
          Returns the thrown exception signatures of the element represented by this binding key.
 java.lang.String[] getTypeArguments()
          Returns the type argument signatures of the element represented by this binding key.
 boolean isParameterizedMethod()
          Returns whether this binding key represents a parameterized method, or if its declaring method is a parameterized method.
 boolean isParameterizedType()
          Returns whether this binding key represents a parameterized type, or if its declaring type is a parameterized type.
 boolean isRawType()
          Returns whether this binding key represents a raw type.
 java.lang.String toSignature()
          Transforms this binding key into a resolved signature.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BindingKey

public BindingKey(java.lang.String key)
Creates a new binding key.

Parameters:
key - the key to decode
Method Detail

createArrayTypeBindingKey

public static java.lang.String createArrayTypeBindingKey(java.lang.String typeKey,
                                                         int arrayDimension)
Creates a new array type binding key from the given type binding key and the given array dimension.

For example:

 
 createArrayTypeBindingKey("LObject;", 1) -> "[LObject;"
 
 

Note: This Method only applies to ECMAScript 4 which is not yet supported

Parameters:
typeKey - the binding key of the given type
arrayDimension - the given array dimension
Returns:
a new array type binding key

createParameterizedTypeBindingKey

public static java.lang.String createParameterizedTypeBindingKey(java.lang.String genericTypeKey,
                                                                 java.lang.String[] argumentTypeKeys)
Creates a new parameterized type binding key from the given generic type binding key and the given argument type binding keys. If the argument type keys array is empty, then a raw type binding key is created.

For example:

 
 createParameterizedTypeBindingKey(
     "LArray<TK;TV;>;",
     new String[] {"LString;", "LObject;"}) ->
       "LArray<LString;LObject;>;"
 createParameterizedTypeBindingKey(
     "LArray<TE;>;", new String[] {}) ->
       "LArray<>;"
 
 

Parameters:
genericTypeKey - the binding key of the generic type
argumentTypeKeys - the possibly empty list of binding keys of argument types
Returns:
a new parameterized type binding key

createTypeBindingKey

public static java.lang.String createTypeBindingKey(java.lang.String typeName)
Creates a new type binding key from the given type name.

For example:

 
 createTypeBindingKey("String") -> "LString;"
 
 

Note: This Method only applies to ECMAScript 4 which is not yet supported

Parameters:
typeName - the possibly qualified type name
Returns:
a new type binding key

createTypeVariableBindingKey

public static java.lang.String createTypeVariableBindingKey(java.lang.String typeVariableName,
                                                            java.lang.String declaringKey)
Creates a new type variable binding key from the given type variable name and the given declaring key. The declaring key can either be a type binding key or a method binding key.

For example:

 
 createTypeVariableBindingKey("T", "LArray<TE;>;") ->
   "LArray<TE;>;:TT;"
 
 

Note: This Method only applies to ECMAScript 4 which is not yet supported

Parameters:
typeVariableName - the name of the given type variable
declaringKey - the binding key of the type or method the type variable belongs to
Returns:
a new type variable binding key

createWilcardTypeBindingKey

public static java.lang.String createWilcardTypeBindingKey(java.lang.String typeKey,
                                                           char kind)
Creates a new wildcard type binding key from the given type binding key and the given wildcard kind (one of Signature.C_STAR, Signature.C_SUPER, or Signature.C_EXTENDS. If the wildcard is Signature.C_STAR, the given type binding key is ignored.

For example:

 
 createWilcardTypeBindingKey(null, Signature.C_STAR) -> "*"
 createWilcardTypeBindingKey("LArray<TE;>;",
    Signature.C_SUPER) -> "-LArray<TE;>;"
 createWilcardTypeBindingKey("LArray;", Signature.C_EXTENDS) ->
    "+Ljava/util/ArrayList;"
 
 

Note: This Method only applies to ECMAScript 4 which is not yet supported

Parameters:
typeKey - the binding key of the given type
kind - one of Signature.C_STAR, Signature.C_SUPER, or Signature.C_EXTENDS
Returns:
a new wildcard type binding key

getThrownExceptions

public java.lang.String[] getThrownExceptions()
Returns the thrown exception signatures of the element represented by this binding key. If this binding key does not represent a function or does not throw any exception, returns an empty array.

Note: This Method only applies to ECMAScript 4 which is not yet supported

Returns:
the thrown exceptions signatures

getTypeArguments

public java.lang.String[] getTypeArguments()
Returns the type argument signatures of the element represented by this binding key. If this binding key doesn't represent a parameterized type or a parameterized method, returns an empty array.

Returns:
the type argument signatures

isRawType

public boolean isRawType()
Returns whether this binding key represents a raw type.

Note: This Method only applies to ECMAScript 4 which is not yet supported

Returns:
whether this binding key represents a raw type

isParameterizedType

public boolean isParameterizedType()
Returns whether this binding key represents a parameterized type, or if its declaring type is a parameterized type.

Note: This Method only applies to ECMAScript 4 which is not yet supported

Returns:
whether this binding key represents a parameterized type

isParameterizedMethod

public boolean isParameterizedMethod()
Returns whether this binding key represents a parameterized method, or if its declaring method is a parameterized method.

Note: This Method only applies to ECMAScript 4 which is not yet supported

Returns:
whether this binding key represents a parameterized method

toSignature

public java.lang.String toSignature()
Transforms this binding key into a resolved signature. If this binding key represents a field, the returned signature is the declaring type's signature.

Returns:
the resolved signature for this binding key
See Also:
Signature

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object