Class ExternalHelpFactory
java.lang.Object
com.github.rvesse.airline.help.external.factories.ExternalHelpFactory
- All Implemented Interfaces:
HelpSectionFactory
Help section factory that enables the additional annotations provided by this module
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DefaultExternalHelpParser
private static final List
<Class<? extends Annotation>> Supported annotations -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateSection
(Annotation annotation) Tries to create a section from the given annotationprotected ParagraphsParser
loadParagraphsParser
(Class<? extends ParagraphsParser> parserCls) Loads the paragraphs parserprotected TabularParser
loadTabularParser
(Class<? extends TabularParser> parserCls) Loads the tabular parserprotected InputStream
openResource
(ResourceLocator[] resourceLocators, String resource) Opens the specified resource using the first resource locator that is able to open itprotected String[]
parseParagraphs
(ResourceLocator[] resourceLocators, String resource, ParagraphsParser parser) Parses paragraphs from a resourceparseTabular
(ResourceLocator[] resourceLocators, String resource, TabularParser parser) Parses tabular data from a resourceprotected String[]
rowToArray
(List<List<String>> rows, int columnIndex) Converts one column of a list of rows into an arrayprotected int[]
rowToNumericArray
(List<List<String>> rows, int columnIndex, String resource) Converts one column of a list of rows into an arrayList
<Class<? extends Annotation>> Gets a list of the supported annotations
-
Field Details
-
defaultParser
-
SUPPORTED
Supported annotations
-
-
Constructor Details
-
ExternalHelpFactory
public ExternalHelpFactory()
-
-
Method Details
-
createSection
Description copied from interface:HelpSectionFactory
Tries to create a section from the given annotation- Specified by:
createSection
in interfaceHelpSectionFactory
- Parameters:
annotation
- Annotation- Returns:
- Help section or
null
if the annotation is not supported
-
supportedAnnotations
Description copied from interface:HelpSectionFactory
Gets a list of the supported annotations- Specified by:
supportedAnnotations
in interfaceHelpSectionFactory
- 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 useresource
- 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
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 locatorsresource
- Resourceparser
- Parser- Returns:
- Paragraphs
-
loadTabularParser
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 locatorsresource
- Resourceparser
- Parser- Returns:
- Tabular data
-
rowToArray
Converts one column of a list of rows into an array- Parameters:
rows
- RowscolumnIndex
- Column index of the column to convert- Returns:
- Column array
-
rowToNumericArray
Converts one column of a list of rows into an array- Parameters:
rows
- RowscolumnIndex
- Column index of the column to convert- Returns:
- Column array
-