Class PluginUtil
- java.lang.Object
-
- org.apache.logging.log4j.core.config.plugins.util.PluginUtil
-
public final class PluginUtil extends java.lang.ObjectPluginutilities.- See Also:
PluginManager
-
-
Constructor Summary
Constructors Modifier Constructor Description privatePluginUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,PluginType<?>>collectPluginsByCategory(java.lang.String category)Shortcut for collecting plugins matching with the givencategory.static java.util.Map<java.lang.String,PluginType<?>>collectPluginsByCategoryAndPackage(java.lang.String category, java.util.List<java.lang.String> packages)Short for collecting plugins matching with the givencategoryin providedpackages.static java.lang.reflect.MethodfindPluginFactoryMethod(java.lang.Class<?> pluginClass)Finds thePluginFactory-annotated static method of the given class.static <V> VinstantiatePlugin(java.lang.Class<V> pluginClass)Instantiates the given plugin using its no-argPluginFactory-annotated static method.
-
-
-
Method Detail
-
collectPluginsByCategory
public static java.util.Map<java.lang.String,PluginType<?>> collectPluginsByCategory(java.lang.String category)
Shortcut for collecting plugins matching with the givencategory.
-
collectPluginsByCategoryAndPackage
public static java.util.Map<java.lang.String,PluginType<?>> collectPluginsByCategoryAndPackage(java.lang.String category, java.util.List<java.lang.String> packages)
Short for collecting plugins matching with the givencategoryin providedpackages.
-
instantiatePlugin
public static <V> V instantiatePlugin(java.lang.Class<V> pluginClass)
Instantiates the given plugin using its no-argPluginFactory-annotated static method.- Throws:
java.lang.IllegalStateException- if instantiation fails
-
findPluginFactoryMethod
public static java.lang.reflect.Method findPluginFactoryMethod(java.lang.Class<?> pluginClass)
Finds thePluginFactory-annotated static method of the given class.- Throws:
java.lang.IllegalStateException- if no such method could be found
-
-