Package com.google.common.reflect
Class TypeResolver.TypeVariableKey
java.lang.Object
com.google.common.reflect.TypeResolver.TypeVariableKey
- Enclosing class:
TypeResolver
Wraps around
TypeVariable<?>
to ensure that any two type variables are equal as long as
they are declared by the same GenericDeclaration
and have the same
name, even if their bounds differ.
While resolving a type variable from a var -> type
map, we don't care whether the
type variable's bound has been partially resolved. As long as the type variable "identity"
matches.
On the other hand, if for example we are resolving List<A extends B>
to
List<A extends String>
, we need to compare that <A extends B>
is unequal to <A
extends String>
in order to decide to use the transformed type instead of the original type.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
(package private) boolean
equalsType
(Type type) Returns true iftype
is aTypeVariable
with the same name and declared by the sameGenericDeclaration
.private boolean
equalsTypeVariable
(TypeVariable<?> that) (package private) static TypeResolver.TypeVariableKey
Wrapst
in aTypeVariableKey
if it's a type variable.int
hashCode()
toString()
-
Field Details
-
var
-
-
Constructor Details
-
TypeVariableKey
TypeVariableKey(TypeVariable<?> var)
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
toString
-
forLookup
Wrapst
in aTypeVariableKey
if it's a type variable. -
equalsType
Returns true iftype
is aTypeVariable
with the same name and declared by the sameGenericDeclaration
. -
equalsTypeVariable
-