code: public Class getRoot(Class clazz, HashMap derivesFrom) {
          while (derivesFrom.containsKey(clazz)) clazz = (Class) derivesFrom.get(clazz);
          return clazz;
      }
docs: Unwinds the results of reflecting through the interface inheritance
  hierachy to find the original root class from a derived class