2

I have the following method which expects an object with a parameterized class. Kindly help me find the class of T. For example, i have put a return of JsonObject.class.

private static <T> Class<T> getType(me.yoctopus.util.Response<HttpResponse<T>, JSONException> response) {

   /*
    Type type = ((ParameterizedType) response
            .getClass()
            .getGenericSuperclass()).getActualTypeArguments()[0];
    Type httResponse = ((ParameterizedType) type
            .getClass()
            .getGenericSuperclass()).getActualTypeArguments()[0];
   return (Class<T>) httResponse;*/
   return (Class<T>) JSONObject.class;


}

I need to determine and return the class T

Yoctopus
  • 21
  • 1

0 Answers0