public final class BindingKey extends Object
This class is not intended to be subclassed by clients.
IBinding.getKey()
Constructor and Description |
---|
BindingKey(String key)
Creates a new binding key.
|
Modifier and Type | Method and Description |
---|---|
static String |
createArrayTypeBindingKey(String typeKey,
int arrayDimension)
Creates a new array type binding key from the given type binding key and the given array dimension.
|
static String |
createParameterizedTypeBindingKey(String genericTypeKey,
String[] argumentTypeKeys)
Creates a new parameterized type binding key from the given generic type binding key and the given argument type binding keys.
|
static String |
createTypeBindingKey(String typeName)
Creates a new type binding key from the given type name.
|
static String |
createTypeVariableBindingKey(String typeVariableName,
String declaringKey)
Creates a new type variable binding key from the given type variable name and the given declaring key.
|
static String |
createWilcardTypeBindingKey(String typeKey,
char kind)
Deprecated.
This method is missing crucial information necessary for proper wildcard binding key creation.
|
static String |
createWildcardTypeBindingKey(String genericTypeKey,
char boundKind,
String boundTypeKey,
int rank)
Creates a new wildcard type binding key from the given generic type binding key, the given wildcard
kind (one of
Signature.C_STAR , Signature.C_SUPER , or Signature.C_EXTENDS
the given bound type binding key and the given rank. |
BindingKey |
getDeclaringType()
Returns the binding key of the declaring type of the element represented by this binding key.
|
String[] |
getThrownExceptions()
Returns the thrown exception signatures of the element represented by this binding key.
|
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.
|
String |
toSignature()
Transforms this binding key into a resolved signature.
|
String |
toString() |
public BindingKey(String key)
key
- the key to decodepublic static String createArrayTypeBindingKey(String typeKey, int arrayDimension)
For example:
createArrayTypeBindingKey("Ljava/lang/Object;", 1) -> "[Ljava/lang/Object;"
createArrayTypeBindingKey("I", 2) -> "[[I"
typeKey
- the binding key of the given typearrayDimension
- the given array dimensionpublic static String createParameterizedTypeBindingKey(String genericTypeKey, String[] argumentTypeKeys)
For example:
createParameterizedTypeBindingKey(
"Ljava/util/Map<TK;TV;>;",
new String[] {"Ljava/lang/String;", "Ljava/lang/Object;"}) ->
"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
createParameterizedTypeBindingKey(
"Ljava/util/List<TE;>;", new String[] {}) ->
"Ljava/util/List<>;"
genericTypeKey
- the binding key of the generic typeargumentTypeKeys
- the possibly empty list of binding keys of argument typespublic static String createTypeBindingKey(String typeName)
For example:
createTypeBindingKey("int") -> "I"
createTypeBindingKey("java.lang.String") -> "Ljava/lang/String;"
createTypeBindingKey("boolean[]") -> "[Z"
typeName
- the possibly qualified type namepublic static String createTypeVariableBindingKey(String typeVariableName, String declaringKey)
For example:
createTypeVariableBindingKey("T", "Ljava/util/List<TE;>;") ->
"Ljava/util/List<TE;>;:TT;"
createTypeVariableBindingKey("SomeTypeVariable", "Lp/X;.foo()V") ->
"Lp/X;.foo()V:TSomeTypeVariable;"
typeVariableName
- the name of the given type variabledeclaringKey
- the binding key of the type or method the type variable belongs topublic static String createWilcardTypeBindingKey(String typeKey, char kind)
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("Ljava/util/List<TE;>;",
Signature.C_SUPER) -> "-Ljava/util/List<TE;>;"
createWilcardTypeBindingKey("Ljava/util/ArrayList;", Signature.C_EXTENDS) ->
"+Ljava/util/ArrayList;"
typeKey
- the binding key of the given typekind
- one of Signature.C_STAR
, Signature.C_SUPER
, or Signature.C_EXTENDS
createWildcardTypeBindingKey(String, char, String, int)
public static String createWildcardTypeBindingKey(String genericTypeKey, char boundKind, String boundTypeKey, int rank)
Signature.C_STAR
, Signature.C_SUPER
, or Signature.C_EXTENDS
the given bound type binding key and the given rank. If the wildcard kind is Signature.C_STAR
,
the given bound type binding key is ignored.
For example:
createWildcardTypeBindingKey("Ljava/util/ArrayList;", Signature.C_STAR, null, 0) -> "Ljava/util/ArrayList;{0}*"
createWildcardTypeBindingKey("Ljava/util/ArrayList;", Signature.C_SUPER, "Ljava/lang/String;", 0) -> "Ljava/util/ArrayList;{0}-Ljava/lang/String;"
createWildcardTypeBindingKey("Ljava/util/HashMap;", Signature.C_EXTENDS, "Ljava/lang/String;", 1) ->
"Ljava/util/HashMap;{1}+Ljava/lang/String;"
genericTypeKey
- the binding key of the generic typeboundKind
- one of Signature.C_STAR
, Signature.C_SUPER
, or Signature.C_EXTENDS
boundTypeKey
- the binding key of the bounding type.rank
- the relative position of this wild card type in the parameterization of the generic type.public BindingKey getDeclaringType()
null
.
Note that only binding keys for references to methods and fields are fully supported. The binding keys for declarations will not have type parameters.
null
public String[] getThrownExceptions()
public String[] getTypeArguments()
public boolean isRawType()
public boolean isParameterizedType()
public boolean isParameterizedMethod()
public String toSignature()
Signature
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.