]> source.dussan.org Git - pf4j.git/commitdiff
Allow a way to query all extension classes for a given plugin (#233)
authordustContributor <hctf90@gmail.com>
Tue, 24 Jul 2018 07:16:31 +0000 (04:16 -0300)
committerDecebal Suiu <decebal.suiu@gmail.com>
Tue, 24 Jul 2018 07:16:31 +0000 (10:16 +0300)
pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
pf4j/src/main/java/org/pf4j/PluginManager.java

index 17116ae7e7fd2ebb113fad3baa30463aebaacfbe..f2578d86cd2fe71e20f0a0dfa16283268d2c87cd 100644 (file)
@@ -522,6 +522,18 @@ public abstract class AbstractPluginManager implements PluginManager {
         return pluginClassLoaders.get(pluginId);
     }
 
+    @SuppressWarnings("rawtypes")
+    @Override
+    public List<Class<?>> getExtensionClasses(String pluginId) {
+        List<ExtensionWrapper> extensionsWrapper = extensionFinder.find(pluginId);
+        List<Class<?>> extensionClasses = new ArrayList<>(extensionsWrapper.size());
+        for (ExtensionWrapper extensionWrapper : extensionsWrapper) {
+            Class<?> c = extensionWrapper.getDescriptor().extensionClass;
+            extensionClasses.add(c);
+        }
+        return extensionClasses;
+    }
+
     @SuppressWarnings("unchecked")
     @Override
     public <T> List<Class<T>> getExtensionClasses(Class<T> type) {
index eaa605fadfaf3305056799e9564f2cdd5e9d072d..52fb85b18a4cd5d0f6f07389b93fc630a5bad90e 100644 (file)
@@ -131,6 +131,8 @@ public interface PluginManager {
 
     ClassLoader getPluginClassLoader(String pluginId);
 
+    List<Class<?>> getExtensionClasses(String pluginId);
+
     <T> List<Class<T>> getExtensionClasses(Class<T> type);
 
     <T> List<Class<T>> getExtensionClasses(Class<T> type, String pluginId);