Package org.itsallcode.whiterabbit.api
Interface Plugin
- All Known Implementing Classes:
AbstractPlugin
public interface Plugin
Implement this interface to create a plugin for WhiteRabbit. Register your
plugin by adding file
META-INF/services/org.itsallcode.whiterabbit.api.Plugin containing
the full qualified class name to the jar.
Available features:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Called before closing the plugin.<T extends PluginFeature>
Optional<T> getFeature(Class<T> featureType) Get an instance of the given feature type.getId()The ID of this plugin.voidinit(PluginConfiguration config) Called once when loading the plugin.booleansupports(Class<? extends PluginFeature> featureType) Check if this plugin supports the given feature.
-
Method Details
-
init
Called once when loading the plugin.- Parameters:
config- the configuration of the plugin.
-
getId
String getId()The ID of this plugin. IDs must be unique for all plugins. The ID is used as prefix forPluginConfiguration.getMandatoryValue(String).- Returns:
- the ID of this plugin.
-
supports
Check if this plugin supports the given feature.- Parameters:
featureType- the feature type.- Returns:
trueif this plugin supports the given feature, elsefalse.
-
getFeature
Get an instance of the given feature type.- Type Parameters:
T- the type of the feature.- Parameters:
featureType- the feature type.- Returns:
- the instance of the given feature or an empty
Optionalif the feature is not supported.
-
close
void close()Called before closing the plugin. The plugin should cleanup any resources in this method.
-