private static Map<TypeVariable<?>, Type> getTypeVariableMap(
			final Class<?> clazz) {
		if (clazz == null) {
			return Collections.emptyMap();
		}
		final Map<TypeVariable<?>, Type> map = new LinkedHashMap<TypeVariable<?>, Type>();
		final Class<?> superClass = clazz.getSuperclass();
		final Type superClassType = clazz.getGenericSuperclass();
		if (superClass != null) {
			gatherTypeVariables(superClass, superClassType, map);
		}
		final Class<?>[] interfaces = clazz.getInterfaces();
		final Type[] interfaceTypes = clazz.getGenericInterfaces();
		for (int i = 0; i < interfaces.length; ++i) {
			gatherTypeVariables(interfaces[i], interfaceTypes[i], map);
		}
		return map;
	}