Interface PluginClassLoaderGroup


@Internal public interface PluginClassLoaderGroup
A plugin classloader group represents a group of classloaders that a plugins classloader may access.

An example of this would be a classloader group that holds all direct and transitive dependencies a plugin declared, allowing a plugins classloader to access classes included in these dependencies via this group.

  • Method Details

    • getClassByName

      @Nullable @Nullable Class<?> getClassByName(String name, boolean resolve, ConfiguredPluginClassLoader requester)
      Attempts to find/load a class from this plugin class loader group using the passed fully qualified name in any of the classloaders that are part of this group.

      The lookup order across the contained loaders is not defined on the API level and depends purely on the implementation.

      Parameters:
      name - the fully qualified name of the class to load
      resolve - whether the class should be resolved if needed or not
      requester - plugin classloader that is requesting the class from this loader group
      Returns:
      the class found at the fully qualified class name passed. If the class could not be found, null will be returned.
      See Also:
    • remove

      @Contract(mutates="this") void remove(ConfiguredPluginClassLoader configuredPluginClassLoader)
      Removes a configured plugin classloader from this class loader group. If the classloader is not currently in the list, this method will simply do nothing.
      Parameters:
      configuredPluginClassLoader - the plugin classloader to remove from the group
    • add

      @Contract(mutates="this") void add(ConfiguredPluginClassLoader configuredPluginClassLoader)
      Adds the passed plugin classloader to this group, allowing this group to use it during getClassByName(String, boolean, ConfiguredPluginClassLoader) lookups.

      This method does not query the ClassLoaderAccess (exposed via getAccess()) to ensure if this group has access to the class loader passed.

      Parameters:
      configuredPluginClassLoader - the plugin classloader to add to this group.
    • getAccess

      ClassLoaderAccess getAccess()
      Provides the class loader access that guards and defines the content of this classloader group. While not guaranteed contractually (see add(ConfiguredPluginClassLoader)), the access generally is responsible for defining which ConfiguredPluginClassLoaders should be part of this group and which ones should not.
      Returns:
      the classloader access governing which classloaders should be part of this group and which ones should not.