docs: public static Class<?> genericTypeOf(Class<?> rootClass, Class<?> targetBaseClass, Class<?> targetBaseInterface) {
          //looking for candidates in the hierarchy of rootClass
          Class<?> match = rootClass;
          while(match != Object.class) {
              //check the super class first
              if (match.getSuperclass() == targetBaseClass) {
                  return extractGeneric(match.getGenericSuperclass());
              }
              //check the interfaces (recursively)
              Type genericInterface = findGenericInterface(match, targetBaseInterface);
              if (genericInterface != null) {
                  return extractGeneric(genericInterface);
              }
              //recurse the hierarchy
              match = match.getSuperclass();
          }
          return Object.class;
      }