@Override public TypeInformation<?> getComponentType() { return createInfo(type.getActualTypeArguments()[0]); }
@Override @Nullable protected TypeInformation<?> doGetComponentType() { return createInfo(type.getActualTypeArguments()[0]); }
@Override public List<TypeInformation<?>> getTypeArguments() { List<TypeInformation<?>> result = new ArrayList<>(); for (Type argument : type.getActualTypeArguments()) { result.add(createInfo(argument)); } return result; }
@Override public List<TypeInformation<?>> getTypeArguments() { List<TypeInformation<?>> result = new ArrayList<TypeInformation<?>>(); for (Type argument : type.getActualTypeArguments()) { result.add(createInfo(argument)); } return result; }
private boolean isResolvedCompletely() { Type[] typeArguments = type.getActualTypeArguments(); if (typeArguments.length == 0) { return false; } for (Type typeArgument : typeArguments) { TypeInformation<?> info = createInfo(typeArgument); if (info instanceof ParameterizedTypeInformation) { if (!((ParameterizedTypeInformation<?>) info).isResolvedCompletely()) { return false; } } if (!(info instanceof ClassTypeInformation)) { return false; } } return true; }
private boolean isResolvedCompletely() { Type[] types = type.getActualTypeArguments(); if (types.length == 0) { return false; } for (Type type : types) { TypeInformation<?> info = createInfo(type); if (info instanceof ParameterizedTypeInformation) { if (!((ParameterizedTypeInformation<?>) info).isResolvedCompletely()) { return false; } } if (!(info instanceof ClassTypeInformation)) { return false; } } return true; } }
@Override public TypeInformation<?> getMapValueType() { if (Map.class.equals(getType())) { Type[] arguments = type.getActualTypeArguments(); return createInfo(arguments[1]); } Class<?> rawType = getType(); Set<Type> supertypes = new HashSet<Type>(); supertypes.add(rawType.getGenericSuperclass()); supertypes.addAll(Arrays.asList(rawType.getGenericInterfaces())); for (Type supertype : supertypes) { Class<?> rawSuperType = GenericTypeResolver.resolveType(supertype, getTypeVariableMap()); if (Map.class.isAssignableFrom(rawSuperType)) { ParameterizedType parameterizedSupertype = (ParameterizedType) supertype; Type[] arguments = parameterizedSupertype.getActualTypeArguments(); return createInfo(arguments[1]); } } return super.getMapValueType(); }
@Override @Nullable protected TypeInformation<?> doGetMapValueType() { if (Map.class.isAssignableFrom(getType())) { Type[] arguments = type.getActualTypeArguments(); if (arguments.length > 1) { return createInfo(arguments[1]); } } Class<?> rawType = getType(); Set<Type> supertypes = new HashSet<>(); Optional.ofNullable(rawType.getGenericSuperclass()).ifPresent(supertypes::add); supertypes.addAll(Arrays.asList(rawType.getGenericInterfaces())); Optional<TypeInformation<?>> result = supertypes.stream()// .map(it -> Pair.of(it, resolveType(it)))// .filter(it -> Map.class.isAssignableFrom(it.getSecond()))// .<TypeInformation<?>> map(it -> { ParameterizedType parameterizedSupertype = (ParameterizedType) it.getFirst(); Type[] arguments = parameterizedSupertype.getActualTypeArguments(); return createInfo(arguments[1]); }).findFirst(); return result.orElseGet(super::doGetMapValueType); }