Class PluginUtil
- java.lang.Object
-
- org.apache.logging.log4j.core.config.plugins.util.PluginUtil
-
public final class PluginUtil extends Object
Plugin
utilities.- See Also:
PluginManager
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
collectPluginsByCategory
public static Map<String,PluginType<?>> collectPluginsByCategory(String category)
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
public static <V> V instantiatePlugin(Class<V> pluginClass)
Instantiates the given plugin using its no-argPluginFactory
-annotated static method.- Throws:
IllegalStateException
- if instantiation fails
-
findPluginFactoryMethod
public static Method findPluginFactoryMethod(Class<?> pluginClass)
Finds thePluginFactory
-annotated static method of the given class.- Throws:
IllegalStateException
- if no such method could be found
-
-