Exemplo n.º 1
0
 @Nullable
 private static TypeWrapper wrap(Type type) {
   if (type == null) {
     return null;
   } else if (type instanceof Class) {
     return new ClassTypeWrapper((Class<?>) type);
   } else if (type instanceof ParameterizedType) {
     ParameterizedType parameterizedType = (ParameterizedType) type;
     return new ParameterizedTypeWrapper(
         toWrappers(parameterizedType.getActualTypeArguments()),
         (ClassTypeWrapper) wrap(parameterizedType.getRawType()),
         wrap(parameterizedType.getOwnerType()));
   } else if (type instanceof WildcardType) {
     WildcardType wildcardType = (WildcardType) type;
     return new WildcardTypeWrapper(
         toWrappers(wildcardType.getUpperBounds()),
         toWrappers(wildcardType.getLowerBounds()),
         type.hashCode());
   } else if (type instanceof TypeVariable) {
     TypeVariable<?> typeVariable = (TypeVariable<?>) type;
     return new TypeVariableTypeWrapper(
         typeVariable.getName(), toWrappers(typeVariable.getBounds()), type.hashCode());
   } else if (type instanceof GenericArrayType) {
     GenericArrayType genericArrayType = (GenericArrayType) type;
     return new GenericArrayTypeWrapper(
         wrap(genericArrayType.getGenericComponentType()), type.hashCode());
   } else {
     throw new IllegalArgumentException("cannot wrap type of type " + type.getClass());
   }
 }
Exemplo n.º 2
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((type == null) ? 0 : type.hashCode());
   return result;
 }
Exemplo n.º 3
0
 /**
  * Hashcode for this object.
  *
  * @return hashcode for this object.
  */
 @Override
 public int hashCode() {
   return type.hashCode();
 }
Exemplo n.º 4
0
 @Override
 public int hashCode() {
   // this equals Arrays.hashCode(getLowerBounds()) ^
   // Arrays.hashCode(getUpperBounds());
   return (lowerBound != null ? 31 + lowerBound.hashCode() : 1) ^ (31 + upperBound.hashCode());
 }
Exemplo n.º 5
0
 @Override
 public int hashCode() {
   return componentType.hashCode();
 }
Exemplo n.º 6
0
 @Override
 public int hashCode() {
   return Arrays.hashCode(typeArguments) ^ rawType.hashCode() ^ hashCodeOrZero(ownerType);
 }
 @Override
 public int hashCode() {
   return Arrays.hashCode(actualTypeArguments)
       ^ (ownerType == null ? 0 : ownerType.hashCode())
       ^ (rawType == null ? 0 : rawType.hashCode());
 }
 public ResolutionKey(Object domainObject, Type requestedType) {
   this.domainObject = domainObject;
   this.requestedType = requestedType;
   this.hashCode = System.identityHashCode(domainObject) * 13 + requestedType.hashCode() * 7;
 }
 public int hashCode()
 {
     return Arrays.hashCode(typeArguments) ^ rawType.hashCode() ^ Types.access$100(ownerType);
 }
Exemplo n.º 10
0
 @Override
 public int hashCode() {
   return 37 << 4 | value.hashCode();
 }
Exemplo n.º 11
0
 /**
  * Constructs a new type literal. Derives represented class from type parameter.
  *
  * <p>Clients create an empty anonymous subclass. Doing so embeds the type parameter in the
  * anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure.
  */
 @SuppressWarnings("unchecked")
 protected TypeToken() {
   this.type = getSuperclassTypeParameter(getClass());
   this.rawType = (Class<? super T>) $Gson$Types.getRawType(type);
   this.hashCode = type.hashCode();
 }
Exemplo n.º 12
0
 @Override
 public int hashCode() {
   int result = protocolType != null ? protocolType.hashCode() : 0;
   result = 31 * result + (javaType != null ? javaType.hashCode() : 0);
   return result;
 }
Exemplo n.º 13
0
 @Override
 public int hashCode() {
   int result = nodeType != null ? nodeType.hashCode() : 0;
   result = 31 * result + (type != null ? type.hashCode() : 0);
   return result;
 }
Exemplo n.º 14
0
 jw(Type type) {
   b = iz.d((Type) iy.a(type));
   a = iz.e(b);
   c = b.hashCode();
 }
Exemplo n.º 15
0
 protected jw() {
   b = a(getClass());
   a = iz.e(b);
   c = b.hashCode();
 }
Exemplo n.º 16
0
 @Override
 public int hashCode() {
   return (ownerType == null ? 0 : ownerType.hashCode())
       ^ argumentsList.hashCode()
       ^ rawType.hashCode();
 }