Package org.itsallcode.whiterabbit.api
Interface Plugin
-
public interface PluginImplement this interface to create a plugin for WhiteRabbit. Register your plugin by adding fileMETA-INF/services/org.itsallcode.whiterabbit.api.Plugincontaining the full qualified class name to the jar. Available features:
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Called before closing the plugin.<T extends PluginFeature>
TgetFeature(java.lang.Class<T> featureType)Get an instance of the given feature type.java.lang.StringgetId()The ID of this plugin.voidinit(PluginConfiguration config)Called once when loading the plugin.booleansupports(java.lang.Class<? extends PluginFeature> featureType)Check if this plugin supports the given feature.
-
-
-
Method Detail
-
init
void init(PluginConfiguration config)
Called once when loading the plugin.- Parameters:
config- the configuration of the plugin.
-
getId
java.lang.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
boolean supports(java.lang.Class<? extends PluginFeature> featureType)
Check if this plugin supports the given feature.- Parameters:
featureType- the feature type.- Returns:
trueif this plugin supports the given feature, elsefalse.
-
getFeature
<T extends PluginFeature> T getFeature(java.lang.Class<T> featureType)
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. May return
nullor throw an exception if the feature is not supported.
-
close
void close()
Called before closing the plugin. The plugin should cleanup any resources in this method.
-
-