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) booleanequalsType(Type type) Returns true iftypeis aTypeVariablewith the same name and declared by the sameGenericDeclaration.private booleanequalsTypeVariable(TypeVariable<?> that) (package private) static TypeResolver.TypeVariableKeyWrapstin aTypeVariableKeyif it's a type variable.inthashCode()toString()
-
Field Details
-
var
-
-
Constructor Details
-
TypeVariableKey
TypeVariableKey(TypeVariable<?> var)
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
toString
-
forLookup
Wrapstin aTypeVariableKeyif it's a type variable. -
equalsType
Returns true iftypeis aTypeVariablewith the same name and declared by the sameGenericDeclaration. -
equalsTypeVariable
-