code: public static Class<?> getLastGenericClassType(Class clazz, Class filterClass)
      {
          Type type = getGenericClassType(clazz, filterClass);
  
          if (type instanceof ParameterizedType) {
              ParameterizedType pType = (ParameterizedType) type;
              if (filterClass.isAssignableFrom((Class) pType.getRawType())) {
                  Type[] actualTypes = pType.getActualTypeArguments();
                  if (actualTypes.length > 0 && actualTypes[actualTypes.length - 1] instanceof Class) {
                      return (Class) actualTypes[actualTypes.length - 1];
                  }
              }
          }
  
          return null;
      }
docs: Extract the last generic type from the passed class. For example
  <tt>public Class MyClass implements FilterClass&lt;A, B&gt;, SomeOtherClass&lt;C&gt;</tt> will return {@code B}.
  
  @param clazz the class to extract from
  @param filterClass the class of the generic type we're looking for
  @return the last generic type from the interfaces of the passed class, filtered by the passed filter class