code: private static Class<?> getClass(Type type) {
          if (type instanceof Class) {
              return (Class<?>) type;
          } else if (type instanceof ParameterizedType) {
              return getClass(((ParameterizedType) type).getRawType());
          }
          throw new RuntimeException("Could not convert " + type + " to a class, it is a " + type.getClass());
      }
docs: Convert a {@link Type} to a {@link Class}
  <p>
  Class instances are cast, ParameterizedType instances return the result of {@link ParameterizedType#getRawType()}
  
  @param type the type to convert
  @return the class
  @throws RuntimeException if Type does not represent something that can be converted to a {@link Class}