Class ExternalHelpFactory

  • All Implemented Interfaces:
    HelpSectionFactory

    public class ExternalHelpFactory
    extends java.lang.Object
    implements HelpSectionFactory
    Help section factory that enables the additional annotations provided by this module
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      HelpSection createSection​(java.lang.annotation.Annotation annotation)
      Tries to create a section from the given annotation
      protected ParagraphsParser loadParagraphsParser​(java.lang.Class<? extends ParagraphsParser> parserCls)
      Loads the paragraphs parser
      protected TabularParser loadTabularParser​(java.lang.Class<? extends TabularParser> parserCls)
      Loads the tabular parser
      protected java.io.InputStream openResource​(ResourceLocator[] resourceLocators, java.lang.String resource)
      Opens the specified resource using the first resource locator that is able to open it
      protected java.lang.String[] parseParagraphs​(ResourceLocator[] resourceLocators, java.lang.String resource, ParagraphsParser parser)
      Parses paragraphs from a resource
      protected java.util.List<java.util.List<java.lang.String>> parseTabular​(ResourceLocator[] resourceLocators, java.lang.String resource, TabularParser parser)
      Parses tabular data from a resource
      protected java.lang.String[] rowToArray​(java.util.List<java.util.List<java.lang.String>> rows, int columnIndex)
      Converts one column of a list of rows into an array
      protected int[] rowToNumericArray​(java.util.List<java.util.List<java.lang.String>> rows, int columnIndex, java.lang.String resource)
      Converts one column of a list of rows into an array
      java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> supportedAnnotations()
      Gets a list of the supported annotations
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SUPPORTED

        private static final java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> SUPPORTED
        Supported annotations
    • Constructor Detail

      • ExternalHelpFactory

        public ExternalHelpFactory()
    • Method Detail

      • createSection

        public HelpSection createSection​(java.lang.annotation.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 java.util.List<java.lang.Class<? extends java.lang.annotation.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 java.io.InputStream openResource​(ResourceLocator[] resourceLocators,
                                                   java.lang.String resource)
                                            throws java.io.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:
        java.io.IOException - Thrown if there's a problem opening the resource
      • loadParagraphsParser

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

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

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

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

        protected java.lang.String[] rowToArray​(java.util.List<java.util.List<java.lang.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​(java.util.List<java.util.List<java.lang.String>> rows,
                                          int columnIndex,
                                          java.lang.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