From: dustContributor Date: Tue, 24 Jul 2018 07:16:31 +0000 (-0300) Subject: Allow a way to query all extension classes for a given plugin (#233) X-Git-Tag: release-2.4.0~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bca953698f5546a69e7f627d33fd0d71cd3f3b43;p=pf4j.git Allow a way to query all extension classes for a given plugin (#233) --- diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java index 17116ae..f2578d8 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java @@ -522,6 +522,18 @@ public abstract class AbstractPluginManager implements PluginManager { return pluginClassLoaders.get(pluginId); } + @SuppressWarnings("rawtypes") + @Override + public List> getExtensionClasses(String pluginId) { + List extensionsWrapper = extensionFinder.find(pluginId); + List> extensionClasses = new ArrayList<>(extensionsWrapper.size()); + for (ExtensionWrapper extensionWrapper : extensionsWrapper) { + Class c = extensionWrapper.getDescriptor().extensionClass; + extensionClasses.add(c); + } + return extensionClasses; + } + @SuppressWarnings("unchecked") @Override public List> getExtensionClasses(Class type) { diff --git a/pf4j/src/main/java/org/pf4j/PluginManager.java b/pf4j/src/main/java/org/pf4j/PluginManager.java index eaa605f..52fb85b 100644 --- a/pf4j/src/main/java/org/pf4j/PluginManager.java +++ b/pf4j/src/main/java/org/pf4j/PluginManager.java @@ -131,6 +131,8 @@ public interface PluginManager { ClassLoader getPluginClassLoader(String pluginId); + List> getExtensionClasses(String pluginId); + List> getExtensionClasses(Class type); List> getExtensionClasses(Class type, String pluginId);