@SuppressWarnings("unchecked") public <T> TypeInformation<? extends T> readType(S source, TypeInformation<T> basicType) { Assert.notNull(source); Class<?> documentsTargetType = getDefaultedTypeToBeUsed(source); if (documentsTargetType == null) { return basicType; } Class<T> rawType = basicType == null ? null : basicType.getType(); boolean isMoreConcreteCustomType = rawType == null ? true : rawType.isAssignableFrom(documentsTargetType) && !rawType.equals(documentsTargetType); return isMoreConcreteCustomType ? (TypeInformation<? extends T>) ClassTypeInformation.from(documentsTargetType) : basicType; }
public <T> TypeInformation<? extends T> readType(S source, TypeInformation<T> basicType) { Assert.notNull(source, "Source must not be null!"); Assert.notNull(basicType, "Basic type must not be null!"); Class<?> documentsTargetType = getDefaultedTypeToBeUsed(source); if (documentsTargetType == null) { return basicType; } Class<T> rawType = basicType.getType(); boolean isMoreConcreteCustomType = rawType == null || rawType.isAssignableFrom(documentsTargetType) && !rawType.equals(documentsTargetType); if (!isMoreConcreteCustomType) { return basicType; } ClassTypeInformation<?> targetType = ClassTypeInformation.from(documentsTargetType); return (TypeInformation<? extends T>) basicType.specialize(targetType); }