Module org.firebirdsql.jaybird
Package org.firebirdsql.jaybird.util

# 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

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`PluginLoader.ClassSource`
Sources for loading classes (determines which class loaders to use)

## Method Summary

Modifier and Type
Method
Description
`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.
`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`.
`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`.
`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`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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