code: private static boolean isRootResourceClass(Class<?> c)
      {
          if ( c == null )
          {
              return false;
          }
          else if ( c.isAnnotationPresent(Path.class) )
          {
              return true;
          }
          else
          {
              Class[] arr = c.getInterfaces();
              int len = arr.length;
  
              //noinspection ForLoopReplaceableByForEach
              for ( int i = 0; i < len; ++i )
              {
                  Class clazz = arr[i];
                  if ( clazz.isAnnotationPresent(Path.class) )
                  {
                      return true;
                  }
              }
  
              return false;
          }
      }
docs: copied from Jersey 1.17.1