Class PluginUtil


  • public final class PluginUtil
    extends java.lang.Object
    Plugin utilities.
    See Also:
    PluginManager
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PluginUtil()  
    • 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 given category.
      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 given category in provided packages.
      static java.lang.reflect.Method findPluginFactoryMethod​(java.lang.Class<?> pluginClass)
      Finds the PluginFactory-annotated static method of the given class.
      static <V> V instantiatePlugin​(java.lang.Class<V> pluginClass)
      Instantiates the given plugin using its no-arg PluginFactory-annotated static method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PluginUtil

        private PluginUtil()
    • Method Detail

      • collectPluginsByCategory

        public static java.util.Map<java.lang.String,​PluginType<?>> collectPluginsByCategory​(java.lang.String category)
        Shortcut for collecting plugins matching with the given category.
      • 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 given category in provided packages.
      • instantiatePlugin

        public static <V> V instantiatePlugin​(java.lang.Class<V> pluginClass)
        Instantiates the given plugin using its no-arg PluginFactory-annotated static method.
        Throws:
        java.lang.IllegalStateException - if instantiation fails
      • findPluginFactoryMethod

        public static java.lang.reflect.Method findPluginFactoryMethod​(java.lang.Class<?> pluginClass)
        Finds the PluginFactory-annotated static method of the given class.
        Throws:
        java.lang.IllegalStateException - if no such method could be found