Package com.google.common.reflect
Class TypeResolver.TypeVariableKey
- java.lang.Object
-
- com.google.common.reflect.TypeResolver.TypeVariableKey
-
- Enclosing class:
- TypeResolver
static final class TypeResolver.TypeVariableKey extends java.lang.Object
Wraps aroundTypeVariable<?>
to ensure that any two type variables are equal as long as they are declared by the sameGenericDeclaration
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 to List, we need to compare that is unequal to in order to decide to use the transformed type instead of the original type.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.TypeVariable<?>
var
-
Constructor Summary
Constructors Constructor Description TypeVariableKey(java.lang.reflect.TypeVariable<?> var)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
(package private) boolean
equalsType(java.lang.reflect.Type type)
Returns true iftype
is aTypeVariable
with the same name and declared by the sameGenericDeclaration
.private boolean
equalsTypeVariable(java.lang.reflect.TypeVariable<?> that)
(package private) static TypeResolver.TypeVariableKey
forLookup(java.lang.reflect.Type t)
Wrapst
in aTypeVariableKey
if it's a type variable.int
hashCode()
java.lang.String
toString()
-
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
forLookup
static TypeResolver.TypeVariableKey forLookup(java.lang.reflect.Type t)
Wrapst
in aTypeVariableKey
if it's a type variable.
-
equalsType
boolean equalsType(java.lang.reflect.Type type)
Returns true iftype
is aTypeVariable
with the same name and declared by the sameGenericDeclaration
.
-
equalsTypeVariable
private boolean equalsTypeVariable(java.lang.reflect.TypeVariable<?> that)
-
-