Module com.github.rvesse.airline
Class HelpSectionRegistry
java.lang.Object
com.github.rvesse.airline.help.sections.factories.HelpSectionRegistry
Registry which maps annotations to help sections
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map
<Class<? extends Annotation>, HelpSectionFactory> private static boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addFactory
(Class<? extends Annotation> cls, HelpSectionFactory factory) Registers a help section factory for a given annotation classstatic Set
<Class<? extends Annotation>> Gets all the supported annotation classes that can be translated into help sectionsstatic HelpSection
getHelpSection
(Class<? extends Annotation> cls, Annotation annotation) Given an annotation returns a help section if the annotation can be translated into one by any of the registered factories(package private) static void
init()
static void
reset()
Resets the registry causing it to re-invokeServiceLoader.load(Class)
to reload declared services
-
Field Details
-
FACTORIES
-
init
private static boolean init
-
-
Constructor Details
-
HelpSectionRegistry
public HelpSectionRegistry()
-
-
Method Details
-
init
static void init() -
reset
public static void reset()Resets the registry causing it to re-invokeServiceLoader.load(Class)
to reload declared services -
addFactory
Registers a help section factory for a given annotation class- Parameters:
cls
- Annotation classfactory
- Help section factory
-
getAnnotationClasses
Gets all the supported annotation classes that can be translated into help sections- Returns:
- Annotation classes
-
getHelpSection
Given an annotation returns a help section if the annotation can be translated into one by any of the registered factories- Parameters:
cls
- Annotation classannotation
- Annotation instance- Returns:
- Help Section or
null
if the annotation does not denote a help section
-