Class AbstractPluginFactory<T extends Plugin>

    • Constructor Detail

      • AbstractPluginFactory

        protected AbstractPluginFactory()
    • Method Detail

      • getPluginClass

        protected abstract Class<T> getPluginClass()
      • getPriority

        protected abstract int getPriority​(T obj,
                                           Object... args)
        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 through getPlugin(Object...)
      • getPlugin

        protected T getPlugin​(Object... args)
        Finds the plugin for which getPriority(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 override getPriority(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 ran first.

        null if no plugins are found or have a priority greater than zero.
      • getPlugins

        protected Set<T> getPlugins​(Object... args)
      • register

        public void register​(T plugin)
      • findAllInstances

        protected Collection<T> findAllInstances()
        Finds implementations of the given interface or class and returns instances of them. Standard implementation uses ServiceLoader to find implementations and caches results in allInstances which means the same objects are always returned. If the instances should not be treated as singletons, clone the objects before returning them from getPlugin(Object...).
      • removeInstance

        protected void removeInstance​(T instance)