Package ghidra.framework.plugintool.util

# Class PluginUtils

java.lang.Object
ghidra.framework.plugintool.util.PluginUtils

public class PluginUtils extends Object
Utility class for plugin-related methods.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PluginUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `assertUniquePluginName(Class<? extends Plugin> pluginClass)`
  Ensures the specified Plugin has a unique name among all Plugin classes found in the current ClassSearcher's reach.
  `static Class<? extends Plugin>`
  `forName(String pluginClassName)`
  Returns the Class for a Plugin, by class name.
  `static Class<? extends Plugin>`
  `getDefaultProviderForServiceClass(Class<?> serviceClass)`
  Returns the Plugin Class that is specified as being the defaultProvider for a Service, or null if no default provider is specified.
  `static String`
  `getPluginNameFromClass(Class<? extends Plugin> pluginClass)`
  Returns the name of a Plugin based on its class.
  `static <T extends Plugin>
  T`
  `instantiatePlugin(Class<T> pluginClass, PluginTool tool)`
  Returns a new instance of a `Plugin`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PluginUtils

    public PluginUtils()

- ## Method Details

  - ### instantiatePlugin

    public static <T extends Plugin> T instantiatePlugin(Class<T> pluginClass, PluginTool tool) throws PluginException
    Returns a new instance of a `Plugin`.
    Parameters:
      `pluginClass` - Specific Plugin Class
      `tool` - The `PluginTool` that is the parent of the new Plugin
    Returns:
      a new Plugin instance, never NULL.
    Throws:
      `PluginException` - if problem constructing the Plugin instance.

  - ### forName

    public static Class<? extends Plugin> forName(String pluginClassName) throws PluginException
    Returns the Class for a Plugin, by class name.
    Parameters:
      `pluginClassName` - String class name
    Returns:
      Class that is a Plugin, never null.
    Throws:
      `PluginException` - if specified class does not exist or is not a Plugin.

  - ### getDefaultProviderForServiceClass

    public static Class<? extends Plugin> getDefaultProviderForServiceClass(Class<?> serviceClass)
    Returns the Plugin Class that is specified as being the defaultProvider for a Service, or null if no default provider is specified.

    Parameters:
      `serviceClass` - Service interface class
    Returns:
      Plugin class that provides the specified service

  - ### getPluginNameFromClass

    public static String getPluginNameFromClass(Class<? extends Plugin> pluginClass)
    Returns the name of a Plugin based on its class.
    Parameters:
      `pluginClass` - Class to get name from
    Returns:
      String name, based on Class's getSimpleName()

  - ### assertUniquePluginName

    public static void assertUniquePluginName(Class<? extends Plugin> pluginClass) throws PluginException
    Ensures the specified Plugin has a unique name among all Plugin classes found in the current ClassSearcher's reach.
    Parameters:
      `pluginClass` - Class
    Throws:
      `PluginException` - throws exception if Plugin class is not uniquely named