Class ExternalHelpFactory
- java.lang.Object
-
- com.github.rvesse.airline.help.external.factories.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
-
-
Field Summary
Fields Modifier and Type Field Description private DefaultExternalHelpParserdefaultParserprivate static java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>>SUPPORTEDSupported annotations
-
Constructor Summary
Constructors Constructor Description ExternalHelpFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HelpSectioncreateSection(java.lang.annotation.Annotation annotation)Tries to create a section from the given annotationprotected ParagraphsParserloadParagraphsParser(java.lang.Class<? extends ParagraphsParser> parserCls)Loads the paragraphs parserprotected TabularParserloadTabularParser(java.lang.Class<? extends TabularParser> parserCls)Loads the tabular parserprotected java.io.InputStreamopenResource(ResourceLocator[] resourceLocators, java.lang.String resource)Opens the specified resource using the first resource locator that is able to open itprotected java.lang.String[]parseParagraphs(ResourceLocator[] resourceLocators, java.lang.String resource, ParagraphsParser parser)Parses paragraphs from a resourceprotected java.util.List<java.util.List<java.lang.String>>parseTabular(ResourceLocator[] resourceLocators, java.lang.String resource, TabularParser parser)Parses tabular data from a resourceprotected 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 arrayprotected 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 arrayjava.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>>supportedAnnotations()Gets a list of the supported annotations
-
-
-
Field Detail
-
defaultParser
private final DefaultExternalHelpParser defaultParser
-
SUPPORTED
private static final java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> SUPPORTED
Supported annotations
-
-
Method Detail
-
createSection
public HelpSection createSection(java.lang.annotation.Annotation annotation)
Description copied from interface:HelpSectionFactoryTries to create a section from the given annotation- Specified by:
createSectionin interfaceHelpSectionFactory- Parameters:
annotation- Annotation- Returns:
- Help section or
nullif the annotation is not supported
-
supportedAnnotations
public java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> supportedAnnotations()
Description copied from interface:HelpSectionFactoryGets a list of the supported annotations- Specified by:
supportedAnnotationsin interfaceHelpSectionFactory- 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 useresource- Resource- Returns:
- Input stream for the resource or
nullif 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 locatorsresource- Resourceparser- 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 locatorsresource- Resourceparser- 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- RowscolumnIndex- 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- RowscolumnIndex- Column index of the column to convert- Returns:
- Column array
-
-