Class PluginLoader

java.lang.Object
org.firebirdsql.jaybird.util.PluginLoader

public final class PluginLoader extends Object
Helper methods for loading plugins using ServiceLoader.
Since:
6
Author:
Mark Rotteveel
  • Method Details

    • findPlugins

      public static <T> Collection<T> findPlugins(Class<T> spiClass, Collection<String> fallbackClassNames)
      Finds plugins of type spiClass on the classpath using the class loader of the spiClass and the thread context class loader.
      Type Parameters:
      T - type of the plugin SPI
      Parameters:
      spiClass - service provider interface (SPI) of the plugin
      fallbackClassNames - list of class names to load when no plugin SPI instances were found using ServiceLoader
      Returns:
      collection of plugin SPI instances
    • findPlugins

      public static <T> Collection<T> findPlugins(Class<T> spiClass, Collection<String> fallbackClassNames, PluginLoader.ClassSource classSource)
      Finds plugins of type spiClass on the classpath using class loader indicated by classResource.
      Type Parameters:
      T - type of the plugin SPI
      Parameters:
      spiClass - service provider interface (SPI) of the plugin
      fallbackClassNames - list of class names to load when no plugin SPI instances were found using ServiceLoader
      classSource - source to determine the class loader to use
      Returns:
      collection of plugin SPI instances
    • findPlugins

      public static <T> Collection<T> findPlugins(Class<T> spiClass, Collection<String> fallbackClassNames, PluginLoader.ClassSource... classSources)
      Finds plugins of type spiClass on the classpath using class loader indicated by classResource.
      Type Parameters:
      T - type of the plugin SPI
      Parameters:
      spiClass - service provider interface (SPI) of the plugin
      fallbackClassNames - list of class names to load when no plugin SPI instances were found using ServiceLoader
      classSources - sources to determine the class loader to use
      Returns:
      collection of plugin SPI instances
    • findPlugins

      public static <T> Collection<T> findPlugins(Class<T> spiClass, Collection<String> fallbackClassNames, Set<PluginLoader.ClassSource> classSources)
      Finds plugins of type spiClass on the classpath using class loader indicated by classResource.
      Type Parameters:
      T - type of the plugin SPI
      Parameters:
      spiClass - service provider interface (SPI) of the plugin
      fallbackClassNames - list of class names to load when no plugin SPI instances were found using ServiceLoader
      classSources - sources to determine the class loader to use
      Returns:
      collection of plugin SPI instances