java.lang.Object
com.github.rvesse.airline.help.external.factories.ExternalHelpFactory
All Implemented Interfaces:
HelpSectionFactory

public class ExternalHelpFactory extends Object implements HelpSectionFactory
Help section factory that enables the additional annotations provided by this module
  • Field Details

  • Constructor Details

    • ExternalHelpFactory

      public ExternalHelpFactory()
  • Method Details

    • createSection

      public HelpSection createSection(Annotation annotation)
      Description copied from interface: HelpSectionFactory
      Tries to create a section from the given annotation
      Specified by:
      createSection in interface HelpSectionFactory
      Parameters:
      annotation - Annotation
      Returns:
      Help section or null if the annotation is not supported
    • supportedAnnotations

      public List<Class<? extends Annotation>> supportedAnnotations()
      Description copied from interface: HelpSectionFactory
      Gets a list of the supported annotations
      Specified by:
      supportedAnnotations in interface HelpSectionFactory
      Returns:
      Supported annotations
    • openResource

      protected InputStream openResource(ResourceLocator[] resourceLocators, String resource) throws IOException
      Opens the specified resource using the first resource locator that is able to open it
      Parameters:
      resourceLocators - Resource locators to use
      resource - Resource
      Returns:
      Input stream for the resource or null if it cannot be opened
      Throws:
      IOException - Thrown if there's a problem opening the resource
    • loadParagraphsParser

      protected ParagraphsParser loadParagraphsParser(Class<? extends ParagraphsParser> parserCls)
      Loads the paragraphs parser
      Parameters:
      parserCls - Parser Class
      Returns:
      Parser instance
    • parseParagraphs

      protected String[] parseParagraphs(ResourceLocator[] resourceLocators, String resource, ParagraphsParser parser)
      Parses paragraphs from a resource
      Parameters:
      resourceLocators - Resource locators
      resource - Resource
      parser - Parser
      Returns:
      Paragraphs
    • loadTabularParser

      protected TabularParser loadTabularParser(Class<? extends TabularParser> parserCls)
      Loads the tabular parser
      Parameters:
      parserCls - Parser class
      Returns:
      Parser instance
    • parseTabular

      protected List<List<String>> parseTabular(ResourceLocator[] resourceLocators, String resource, TabularParser parser)
      Parses tabular data from a resource
      Parameters:
      resourceLocators - Resource locators
      resource - Resource
      parser - Parser
      Returns:
      Tabular data
    • rowToArray

      protected String[] rowToArray(List<List<String>> rows, int columnIndex)
      Converts one column of a list of rows into an array
      Parameters:
      rows - Rows
      columnIndex - Column index of the column to convert
      Returns:
      Column array
    • rowToNumericArray

      protected int[] rowToNumericArray(List<List<String>> rows, int columnIndex, String resource)
      Converts one column of a list of rows into an array
      Parameters:
      rows - Rows
      columnIndex - Column index of the column to convert
      Returns:
      Column array