Module com.github.rvesse.airline
Class HelpSectionRegistry
- java.lang.Object
-
- com.github.rvesse.airline.help.sections.factories.HelpSectionRegistry
-
public class HelpSectionRegistry extends java.lang.Object
Registry which maps annotations to help sections
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,HelpSectionFactory>
FACTORIES
private static boolean
init
-
Constructor Summary
Constructors Constructor Description HelpSectionRegistry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addFactory(java.lang.Class<? extends java.lang.annotation.Annotation> cls, HelpSectionFactory factory)
Registers a help section factory for a given annotation classstatic java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>
getAnnotationClasses()
Gets all the supported annotation classes that can be translated into help sectionsstatic HelpSection
getHelpSection(java.lang.Class<? extends java.lang.annotation.Annotation> cls, java.lang.annotation.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 Detail
-
FACTORIES
private static final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,HelpSectionFactory> FACTORIES
-
init
private static boolean init
-
-
Method Detail
-
init
static void init()
-
reset
public static void reset()
Resets the registry causing it to re-invokeServiceLoader.load(Class)
to reload declared services
-
addFactory
public static void addFactory(java.lang.Class<? extends java.lang.annotation.Annotation> cls, HelpSectionFactory factory)
Registers a help section factory for a given annotation class- Parameters:
cls
- Annotation classfactory
- Help section factory
-
getAnnotationClasses
public static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getAnnotationClasses()
Gets all the supported annotation classes that can be translated into help sections- Returns:
- Annotation classes
-
getHelpSection
public static HelpSection getHelpSection(java.lang.Class<? extends java.lang.annotation.Annotation> cls, java.lang.annotation.Annotation annotation)
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
-
-