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 Details

    • init

      void init(PluginConfiguration config)
      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 for PluginConfiguration.getMandatoryValue(String).
      Returns:
      the ID of this plugin.
    • supports

      boolean supports(Class<? extends PluginFeature> featureType)
      Check if this plugin supports the given feature.
      Parameters:
      featureType - the feature type.
      Returns:
      true if this plugin supports the given feature, else false.
    • getFeature

      <T extends PluginFeature> Optional<T> getFeature(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 or an empty Optional if the feature is not supported.
    • close

      void close()
      Called before closing the plugin. The plugin should cleanup any resources in this method.