Package liquibase.plugin
Class AbstractPluginFactory<T extends Plugin>
java.lang.Object
liquibase.plugin.AbstractPluginFactory<T>
- All Implemented Interfaces:
PluginFactory
,SingletonObject
- Direct Known Subclasses:
AnalyticsConfigurationFactory
,AnalyticsFactory
,ChangeFactory
,ChangeLogHistoryServiceFactory
,ChangeSetServiceFactory
,ExecutorService
,LicenseServiceFactory
,LogFactory
,LogServiceFactory
,MdcManagerFactory
,OutputFileHandlerFactory
,PathHandlerFactory
,ShowSummaryGeneratorFactory
,SqlParserFactory
,TestSystemFactory
,UIServiceFactory
,ValidatingVisitorGeneratorFactory
public abstract class AbstractPluginFactory<T extends Plugin>
extends Object
implements PluginFactory
Convenience base class for all factories that find correct
Plugin
implementations.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<T>
Finds implementations of the given interface or class and returns instances of them.protected T
Finds the plugin for whichgetPriority(Plugin, Object...)
returns the highest value for the given scope and args.getPlugins
(Object... args) protected abstract int
getPriority
(T obj, Object... args) Returns the priority of the given object based on the passed args array.void
protected void
removeInstance
(T instance)
-
Constructor Details
-
AbstractPluginFactory
protected AbstractPluginFactory()
-
-
Method Details
-
getPluginClass
-
getPriority
Returns the priority of the given object based on the passed args array. The args are created as part of the custom public getPlugin method in implementations are passed throughgetPlugin(Object...)
-
getPlugin
Finds the plugin for whichgetPriority(Plugin, Object...)
returns the highest value for the given scope and args. This method is called by a public implementation-specific methods. Normally this does not need to be overridden, instead overridegetPriority(Plugin, Object...)
to compute the priority of each object for the scope and arguments passed to this method.However, if there is a
Scope
key of "liquibase.plugin.${plugin.interface.class.Name}", an instance of that class will always be run first.- Returns:
- null if no plugins are found or have a priority greater than zero.
-
getPlugins
-
register
-
findAllInstances
Finds implementations of the given interface or class and returns instances of them. Standard implementation usesServiceLoader
to find implementations and caches results inallInstances
which means the same objects are always returned. If the instances should not be treated as singletons, clone the objects before returning them fromgetPlugin(Object...)
. -
removeInstance
-