System.out.println(" " + extension);
}
+ System.out.println("Extension classes by classpath:");
+ List<Class<Greeting>> greetingsClasses = pluginManager.getExtensionClasses(Greeting.class);
+ for (Class<Greeting> greeting : greetingsClasses) {
+ System.out.println(" Class: " + greeting.getCanonicalName());
+ }
+
// print extensions ids for each started plugin
List<PluginWrapper> startedPlugins = pluginManager.getStartedPlugins();
for (PluginWrapper plugin : startedPlugins) {
private Path pluginsRoot;
- private ExtensionFinder extensionFinder;
+ protected ExtensionFinder extensionFinder;
private PluginDescriptorFinder pluginDescriptorFinder;
return pluginClassLoaders.get(pluginId);
}
+ @Override
+ public <T> List<Class<T>> getExtensionClasses(Class<T> type) {
+ List<ExtensionWrapper<T>> extensionsWrapper = extensionFinder.find(type);
+ List<Class<T>> extensionClasses = new ArrayList<>(extensionsWrapper.size());
+ for (ExtensionWrapper<T> extensionWrapper : extensionsWrapper) {
+ @SuppressWarnings("unchecked")
+ Class<T> c = (Class<T>)extensionWrapper.getDescriptor().extensionClass;
+ extensionClasses.add(c);
+ }
+ return extensionClasses;
+ }
+
+ @Override
+ public <T> List<Class<T>> getExtensionClasses(Class<T> type, String pluginId) {
+ List<ExtensionWrapper<T>> extensionsWrapper = extensionFinder.find(type, pluginId);
+ List<Class<T>> extensionClasses = new ArrayList<>(extensionsWrapper.size());
+ for (ExtensionWrapper<T> extensionWrapper : extensionsWrapper) {
+ @SuppressWarnings("unchecked")
+ Class<T> c = (Class<T>)extensionWrapper.getDescriptor().extensionClass;
+ extensionClasses.add(c);
+ }
+ return extensionClasses;
+ }
+
@Override
public <T> List<T> getExtensions(Class<T> type) {
List<ExtensionWrapper<T>> extensionsWrapper = extensionFinder.find(type);
ClassLoader getPluginClassLoader(String pluginId);
+ <T> List<Class<T>> getExtensionClasses(Class<T> type);
+
+ <T> List<Class<T>> getExtensionClasses(Class<T> type, String pluginId);
+
<T> List<T> getExtensions(Class<T> type);
<T> List<T> getExtensions(Class<T> type, String pluginId);