From bca953698f5546a69e7f627d33fd0d71cd3f3b43 Mon Sep 17 00:00:00 2001 From: dustContributor Date: Tue, 24 Jul 2018 04:16:31 -0300 Subject: [PATCH] Allow a way to query all extension classes for a given plugin (#233) --- .../main/java/org/pf4j/AbstractPluginManager.java | 12 ++++++++++++ pf4j/src/main/java/org/pf4j/PluginManager.java | 2 ++ 2 files changed, 14 insertions(+) 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); -- 2.39.5