code: private Class<?> resolveClass(Type type) {
      if (type instanceof Class) {
        return (Class<?>) type;
      } else if (type instanceof ParameterizedType) {
        return resolveClass(((ParameterizedType) type).getRawType());
      } else if (type instanceof WildcardType) {
        Type[] bounds = ((WildcardType) type).getUpperBounds();
        if (bounds.length > 0) {
          return (Class<?>) bounds[0];
        }
      }
      return null;
    }
docs: Resolves the generic class for the given type.