code: private static Class<?> getTypedClass(java.lang.reflect.Type type)
      {
          if (type instanceof Class)
          {
              return ((Class) type);
          }
          else if (type instanceof ParameterizedType)
          {
              java.lang.reflect.Type rawParamterizedType = ((ParameterizedType) type).getRawType();
              return getTypedClass(rawParamterizedType);
          }
          else if (type instanceof TypeVariable)
          {
              java.lang.reflect.Type upperBound = ((TypeVariable) type).getBounds()[0];
              return getTypedClass(upperBound);
          }
  
          throw new IllegalArgumentException("Error while finding generic class for :" + type);
      }
docs: Gets the typed class.
  
  @param type
  the type
  @return the typed class