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 Summary
Modifier and TypeMethodDescriptionvoid
add
(ConfiguredPluginClassLoader configuredPluginClassLoader) Adds the passed plugin classloader to this group, allowing this group to use it duringgetClassByName(String, boolean, ConfiguredPluginClassLoader)
lookups.Provides the class loader access that guards and defines the content of this classloader group.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.void
remove
(ConfiguredPluginClassLoader configuredPluginClassLoader) Removes a configured plugin classloader from this class loader 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 loadresolve
- whether the class should be resolved if needed or notrequester
- 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
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
Adds the passed plugin classloader to this group, allowing this group to use it duringgetClassByName(String, boolean, ConfiguredPluginClassLoader)
lookups.This method does not query the
ClassLoaderAccess
(exposed viagetAccess()
) 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 (seeadd(ConfiguredPluginClassLoader)
), the access generally is responsible for defining whichConfiguredPluginClassLoader
s 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.
-