public ResolvedType getTypeParameterFor(ResolvedType type, Class<?> erasedSuperType, int parameterIndex) {
        List<ResolvedType> typeParameters = type.typeParametersFor(erasedSuperType);
        if (typeParameters == null) {
            // given type is not a super type of the type in scope
            return null;
        }
        if (!typeParameters.isEmpty() && typeParameters.size() <= parameterIndex) {
            // given index is out of bounds for the specific type
        }
        if (typeParameters.isEmpty() && erasedSuperType.getTypeParameters().length <= parameterIndex) {
            // given index is out of bounds for the designated super type
            return null;
        }
        if (typeParameters.isEmpty()) {
            // no type parameters are defined, for simplicity's sake not trying to resolve declared boundaries
            return this.resolve(Object.class);
        }
        return typeParameters.get(parameterIndex);
    }
Find type parameterization for the specified (super) type at return the type parameter at the given index.

@param type type to find type parameter for
@param erasedSuperType (super) type to find declared type parameter for
@param parameterIndex index of the single type parameter's declared type to return
@return declared parameter type; or {@code Object.class} if no parameters are defined; or null if the given type or index are invalid
@see ResolvedType#typeParametersFor(Class)
jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/TypeContext.java