private static void collectActualTypeArguments(final ParameterizedType parameterizedType,
                                                   final Map<TypeVariable<?>, Type> map) {
        // get the raw type of the parameterized class and validate its a class
        Type rawType = parameterizedType.getRawType();
        if (!(rawType instanceof Class)) {
            return;
        }

        // get variables and types and store them into the map
        TypeVariable<?>[] variables = ((Class<?>)rawType).getTypeParameters();
        Type[] types = parameterizedType.getActualTypeArguments();

        for (int i = 0; i < variables.length; i++) {
            // found a valid parameter class
            if (types[i] instanceof Class) {
                map.put(variables[i], types[i]);
            }
        }
    }
collects all TypeVariable to Type mappings from a parameterizedType
core/src/main/java/com/github/dozermapper/core/util/TypeResolver.java