/** * Check if this type is assignable from the given class object. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Class<?> cls) { return isAssignableFrom((Type) cls); }
/** * Check if this type is assignable from the given type token. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(TypeToken<?> token) { return isAssignableFrom(token.getType()); }
/** * Private helper function that performs some assignability checks for * the provided GenericArrayType. */ private static boolean isAssignableFrom(Type from, GenericArrayType to) { Type toGenericComponentType = to.getGenericComponentType(); if (toGenericComponentType instanceof ParameterizedType) { Type t = from; if (from instanceof GenericArrayType) { t = ((GenericArrayType) from).getGenericComponentType(); } else if (from instanceof Class<?>) { Class<?> classType = (Class<?>) from; while (classType.isArray()) { classType = classType.getComponentType(); } t = classType; } return isAssignableFrom(t, (ParameterizedType) toGenericComponentType, new HashMap<String, Type>()); } // No generic defined on "to"; therefore, return true and let other // checks determine assignability return true; }
/** * Check if this type is assignable from the given Type. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Type from) { if (from == null) { return false; } if (type.equals(from)) { return true; } if (type instanceof Class<?>) { return rawType.isAssignableFrom($Gson$Types.getRawType(from)); } else if (type instanceof ParameterizedType) { return isAssignableFrom(from, (ParameterizedType) type, new HashMap<String, Type>()); } else if (type instanceof GenericArrayType) { return rawType.isAssignableFrom($Gson$Types.getRawType(from)) && isAssignableFrom(from, (GenericArrayType) type); } else { throw buildUnexpectedTypeError( type, Class.class, ParameterizedType.class, GenericArrayType.class); } }
if (isAssignableFrom(itype, to, new HashMap<String, Type>(typeVarMap))) { return true; return isAssignableFrom(sType, to, new HashMap<String, Type>(typeVarMap));
/** * Check if this type is assignable from the given class object. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Class<?> cls) { return isAssignableFrom((Type) cls); }
/** * Check if this type is assignable from the given class object. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Class<?> cls) { return isAssignableFrom((Type) cls); }
/** * Check if this type is assignable from the given class object. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Class<?> cls) { return isAssignableFrom((Type) cls); }
/** * Check if this type is assignable from the given class object. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Class<?> cls) { return isAssignableFrom((Type) cls); }
/** * Check if this type is assignable from the given class object. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Class<?> cls) { return isAssignableFrom((Type) cls); }
/** * Check if this type is assignable from the given class object. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Class<?> cls) { return isAssignableFrom((Type) cls); }
/** * Check if this type is assignable from the given class object. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(Class<?> cls) { return isAssignableFrom((Type) cls); }
/** * Check if this type is assignable from the given type token. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(TypeToken<?> token) { return isAssignableFrom(token.getType()); }
/** * Check if this type is assignable from the given type token. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(TypeToken<?> token) { return isAssignableFrom(token.getType()); }
/** * Check if this type is assignable from the given type token. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(TypeToken<?> token) { return isAssignableFrom(token.getType()); }
/** * Check if this type is assignable from the given type token. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(TypeToken<?> token) { return isAssignableFrom(token.getType()); }
/** * Check if this type is assignable from the given type token. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(TypeToken<?> token) { return isAssignableFrom(token.getType()); }
/** * Check if this type is assignable from the given type token. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(TypeToken<?> token) { return isAssignableFrom(token.getType()); }
/** * Check if this type is assignable from the given type token. * * @deprecated this implementation may be inconsistent with javac for types * with wildcards. */ @Deprecated public boolean isAssignableFrom(TypeToken<?> token) { return isAssignableFrom(token.getType()); }
/** * Private helper function that performs some assignability checks for * the provided GenericArrayType. */ private static boolean isAssignableFrom(Type from, GenericArrayType to) { Type toGenericComponentType = to.getGenericComponentType(); if (toGenericComponentType instanceof ParameterizedType) { Type t = from; if (from instanceof GenericArrayType) { t = ((GenericArrayType) from).getGenericComponentType(); } else if (from instanceof Class<?>) { Class<?> classType = (Class<?>) from; while (classType.isArray()) { classType = classType.getComponentType(); } t = classType; } return isAssignableFrom(t, (ParameterizedType) toGenericComponentType, new HashMap<String, Type>()); } // No generic defined on "to"; therefore, return true and let other // checks determine assignability return true; }