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 DefaultExternalHelpParserprivate 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 ParagraphsParserloadParagraphsParser(Class<? extends ParagraphsParser> parserCls) Loads the paragraphs parserprotected TabularParserloadTabularParser(Class<? extends TabularParser> parserCls) Loads the tabular parserprotected InputStreamopenResource(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: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
Description copied from interface:HelpSectionFactoryGets a list of the supported annotations- Specified by:
supportedAnnotationsin 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
nullif 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
-
rowToNumericArray
-