Class DocumentationLoader

java.lang.Object
ai.wanaku.cli.main.support.DocumentationLoader

public class DocumentationLoader extends Object
Utility class for loading documentation resources in both JVM and native mode.

This class provides methods to load Markdown documentation files from the classpath in a way that works correctly in both regular JVM mode and GraalVM native image mode.

Resources are loaded using the thread context class loader, which ensures compatibility with Quarkus native compilation.

Example usage:


 // Load label expressions documentation
 String markdown = DocumentationLoader.loadLabelExpressionsDoc();
 printer.printMarkdown(markdown);

 // Load custom documentation
 String custom = DocumentationLoader.loadDoc("docs/MY_DOC.md");
 
  • Method Details

    • loadLabelExpressionsDoc

      public static String loadLabelExpressionsDoc() throws IOException
      Loads the label expressions documentation.

      This is a convenience method that loads the standard label expressions documentation file.

      Returns:
      the label expressions documentation as a String
      Throws:
      DocumentationLoader.DocumentationNotFoundException - if the documentation file cannot be found
      IOException - if an error occurs reading the documentation
    • loadDoc

      public static String loadDoc(String resourcePath) throws IOException
      Loads a documentation file from the classpath.

      The path should be relative to the resources directory. For example, to load src/main/resources/docs/MY_DOC.md, use "docs/MY_DOC.md".

      This method works correctly in both JVM and GraalVM native image mode, provided the resource is included in the native image configuration.

      Parameters:
      resourcePath - the path to the documentation file (relative to resources directory)
      Returns:
      the documentation content as a String
      Throws:
      DocumentationLoader.DocumentationNotFoundException - if the documentation file cannot be found
      IOException - if an error occurs reading the documentation