Class AbstractPlugin<S extends PluginFeature>

  • All Implemented Interfaces:
    Plugin

    public abstract class AbstractPlugin<S extends PluginFeature>
    extends java.lang.Object
    implements Plugin
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractPlugin​(java.lang.String id, java.lang.Class<S> featureType)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Called before closing the plugin.
      protected abstract S createInstance()  
      <T extends PluginFeature>
      java.util.Optional<T>
      getFeature​(java.lang.Class<T> featureType)
      Get an instance of the given feature type.
      java.lang.String getId()
      The ID of this plugin.
      void init​(PluginConfiguration config)
      Called once when loading the plugin.
      boolean supports​(java.lang.Class<? extends PluginFeature> featureType)
      Check if this plugin supports the given feature.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractPlugin

        protected AbstractPlugin​(java.lang.String id,
                                 java.lang.Class<S> featureType)
    • Method Detail

      • init

        public void init​(PluginConfiguration config)
        Description copied from interface: Plugin
        Called once when loading the plugin.
        Specified by:
        init in interface Plugin
        Parameters:
        config - the configuration of the plugin.
      • close

        public void close()
        Description copied from interface: Plugin
        Called before closing the plugin. The plugin should cleanup any resources in this method.
        Specified by:
        close in interface Plugin
      • supports

        public boolean supports​(java.lang.Class<? extends PluginFeature> featureType)
        Description copied from interface: Plugin
        Check if this plugin supports the given feature.
        Specified by:
        supports in interface Plugin
        Parameters:
        featureType - the feature type.
        Returns:
        true if this plugin supports the given feature, else false.
      • createInstance

        protected abstract S createInstance()
      • getFeature

        public <T extends PluginFeature> java.util.Optional<T> getFeature​(java.lang.Class<T> featureType)
        Description copied from interface: Plugin
        Get an instance of the given feature type.
        Specified by:
        getFeature in interface Plugin
        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.