@Override
  protected void doWithResourceDocument(ResourceDocument document, Class<?> classOfResource) {
    // Check if the class is present in the builder.
    if (javaDocBuilder.getClassByName(classOfResource.getName()) == null)
      throw new IllegalArgumentException(
          "Class " + classOfResource + " was not found within the specified source files.");

    JavaClass javaClass = javaDocBuilder.getClassByName(classOfResource.getName());

    document.setDescription(javaClass.getComment());
    document.setTitle(titleOrNull(javaClass));
  }
  @Override
  protected void doWithResourceDocument(ResourceDocument document, Class<?> classOfResource) {
    LOG.info("Generating ResourceDocument for {}", classOfResource);
    if (!classOfResource.isAnnotationPresent(ResourceDoc.class)) {
      throw new RuntimeException(
          "Cannot generate documentation for a resource class "
              + "that is not annotated with @ResoureceDoc");
    }

    // --- Process TGIRest annotations
    ResourceDoc rd = (ResourceDoc) classOfResource.getAnnotation(ResourceDoc.class);
    document.setDescription(rd.description());
    document.setTitle(rd.title());
  }