public final class PluginLoader extends java.lang.Object implements PluginFinder
| Constructor and Description |
|---|
PluginLoader(ClassLoaderInjector classLoaderInjector) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<PluginContainer> |
all()
Gets a collection of all plugins.
|
void |
disable()
Disable loaded containers.
|
void |
enable()
Enable loaded containers.
|
PluginContainer |
find(java.lang.String id)
Finds a plugin by the specified id.
|
void |
findAll(java.nio.file.Path directory)
Search
directory for plugin candidates. |
void |
findClassPath(java.net.URLClassLoader loader)
Search
loader for plugin candidates. |
boolean |
load()
Load plugin candidates into plugin containers.
|
java.lang.String |
toString() |
public PluginLoader(@NonNull
ClassLoaderInjector classLoaderInjector)
public void findAll(@NonNull
java.nio.file.Path directory)
throws java.io.IOException
directory for plugin candidates.directory - the directory to searchjava.io.IOException - if an exception occurred while searching for plugin candidatespublic void findClassPath(@NonNull
java.net.URLClassLoader loader)
throws java.io.IOException
loader for plugin candidates.loader - the class loader to searchjava.io.IOException - if an exception occurred while searching for plugin candidatespublic boolean load()
Candidate sources will be injected into the classloader provided by the classloader injector.
true if candidates have been loaded into containers, false if notpublic void enable()
public void disable()
@NonNull public java.util.Collection<PluginContainer> all()
PluginFinderall in interface PluginFinder@Nullable public PluginContainer find(@NonNull java.lang.String id)
PluginFinderfind in interface PluginFinderid - the idnull if no plugin with the specified id could be foundpublic java.lang.String toString()
toString in class java.lang.Object