Browse Source

Allow a way to query all extension classes for a given plugin (#233)

pull/239/head
dustContributor 7 years ago committed by Decebal Suiu
parent
commit
bca953698f
  1. 12
      pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
  2. 2
      pf4j/src/main/java/org/pf4j/PluginManager.java

12
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<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) {

2
pf4j/src/main/java/org/pf4j/PluginManager.java

@ -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);

Loading…
Cancel
Save