You could at least account for subtyping, using Class.isAssignableFrom() and ParameterizedType.getActualTypeArguments().