Class PluginUtil
java.lang.Object
org.apache.logging.log4j.core.config.plugins.util.PluginUtil
Plugin
utilities.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map<String,
PluginType<?>> collectPluginsByCategory
(String category) Shortcut for collecting plugins matching with the givencategory
.static Map<String,
PluginType<?>> collectPluginsByCategoryAndPackage
(String category, List<String> packages) Short for collecting plugins matching with the givencategory
in providedpackages
.static Method
findPluginFactoryMethod
(Class<?> pluginClass) Finds thePluginFactory
-annotated static method of the given class.static <V> V
instantiatePlugin
(Class<V> pluginClass) Instantiates the given plugin using its no-argPluginFactory
-annotated static method.
-
Method Details
-
collectPluginsByCategory
Shortcut for collecting plugins matching with the givencategory
. -
collectPluginsByCategoryAndPackage
public static Map<String,PluginType<?>> collectPluginsByCategoryAndPackage(String category, List<String> packages) Short for collecting plugins matching with the givencategory
in providedpackages
. -
instantiatePlugin
Instantiates the given plugin using its no-argPluginFactory
-annotated static method.- Throws:
IllegalStateException
- if instantiation fails
-
findPluginFactoryMethod
Finds thePluginFactory
-annotated static method of the given class.- Throws:
IllegalStateException
- if no such method could be found
-