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.ObjectWraps aroundTypeVariable<?>to ensure that any two type variables are equal as long as they are declared by the sameGenericDeclarationand have the same name, even if their bounds differ.While resolving a type variable from a
var -> typemap, 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>toList<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 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 booleanequals(java.lang.Object obj)(package private) booleanequalsType(java.lang.reflect.Type type)Returns true iftypeis aTypeVariablewith the same name and declared by the sameGenericDeclaration.private booleanequalsTypeVariable(java.lang.reflect.TypeVariable<?> that)(package private) static TypeResolver.TypeVariableKeyforLookup(java.lang.reflect.Type t)Wrapstin aTypeVariableKeyif it's a type variable.inthashCode()java.lang.StringtoString()
-
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
forLookup
static TypeResolver.TypeVariableKey forLookup(java.lang.reflect.Type t)
Wrapstin aTypeVariableKeyif it's a type variable.
-
equalsType
boolean equalsType(java.lang.reflect.Type type)
Returns true iftypeis aTypeVariablewith the same name and declared by the sameGenericDeclaration.
-
equalsTypeVariable
private boolean equalsTypeVariable(java.lang.reflect.TypeVariable<?> that)
-
-