java.lang.Object
org.firebirdsql.jaybird.util.PluginLoader
Helper methods for loading plugins using
ServiceLoader
.- Since:
- 6
- Author:
- Mark Rotteveel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Sources for loading classes (determines which class loaders to use) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Collection<T>
findPlugins
(Class<T> spiClass, Collection<String> fallbackClassNames) Finds plugins of typespiClass
on the classpath using the class loader of thespiClass
and the thread context class loader.static <T> Collection<T>
findPlugins
(Class<T> spiClass, Collection<String> fallbackClassNames, Set<PluginLoader.ClassSource> classSources) Finds plugins of typespiClass
on the classpath using class loader indicated byclassResource
.static <T> Collection<T>
findPlugins
(Class<T> spiClass, Collection<String> fallbackClassNames, PluginLoader.ClassSource classSource) Finds plugins of typespiClass
on the classpath using class loader indicated byclassResource
.static <T> Collection<T>
findPlugins
(Class<T> spiClass, Collection<String> fallbackClassNames, PluginLoader.ClassSource... classSources) Finds plugins of typespiClass
on the classpath using class loader indicated byclassResource
.
-
Method Details
-
findPlugins
public static <T> Collection<T> findPlugins(Class<T> spiClass, Collection<String> fallbackClassNames) Finds plugins of typespiClass
on the classpath using the class loader of thespiClass
and the thread context class loader.- Type Parameters:
T
- type of the plugin SPI- Parameters:
spiClass
- service provider interface (SPI) of the pluginfallbackClassNames
- list of class names to load when no plugin SPI instances were found usingServiceLoader
- 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 typespiClass
on the classpath using class loader indicated byclassResource
.- Type Parameters:
T
- type of the plugin SPI- Parameters:
spiClass
- service provider interface (SPI) of the pluginfallbackClassNames
- list of class names to load when no plugin SPI instances were found usingServiceLoader
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 typespiClass
on the classpath using class loader indicated byclassResource
.- Type Parameters:
T
- type of the plugin SPI- Parameters:
spiClass
- service provider interface (SPI) of the pluginfallbackClassNames
- list of class names to load when no plugin SPI instances were found usingServiceLoader
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 typespiClass
on the classpath using class loader indicated byclassResource
.- Type Parameters:
T
- type of the plugin SPI- Parameters:
spiClass
- service provider interface (SPI) of the pluginfallbackClassNames
- list of class names to load when no plugin SPI instances were found usingServiceLoader
classSources
- sources to determine the class loader to use- Returns:
- collection of plugin SPI instances
-