diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2016-08-11 23:07:58 +0300 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2016-08-11 23:07:58 +0300 |
commit | f595eb5dfaea617af739df9e8e8de94a0a44a67a (patch) | |
tree | 187daf89d3b2c487cba3f9dc00e21e36d7c095d9 /demo | |
parent | d6f9ccb1196d12c96400889369a01122ed684160 (diff) | |
download | pf4j-f595eb5dfaea617af739df9e8e8de94a0a44a67a.tar.gz pf4j-f595eb5dfaea617af739df9e8e8de94a0a44a67a.zip |
Return a list of all extensions from a plugin and optional for an extension point
Diffstat (limited to 'demo')
-rw-r--r-- | demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java b/demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java index 2394761..fa779e2 100644 --- a/demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java +++ b/demo/app/src/main/java/ro/fortsoft/pf4j/demo/Boot.java @@ -56,13 +56,13 @@ public class Boot { } // print extensions from classpath (non plugin) - System.out.println(String.format("Extensions added by classpath:")); + System.out.println("Extensions added by classpath:"); Set<String> extensionClassNames = pluginManager.getExtensionClassNames(null); for (String extension : extensionClassNames) { System.out.println(" " + extension); } - // print extensions for each started plugin + // print extensions ids for each started plugin List<PluginWrapper> startedPlugins = pluginManager.getStartedPlugins(); for (PluginWrapper plugin : startedPlugins) { String pluginId = plugin.getDescriptor().getPluginId(); @@ -73,6 +73,33 @@ public class Boot { } } + // print the extensions instances for Greeting extension point for each started plugin + for (PluginWrapper plugin : startedPlugins) { + String pluginId = plugin.getDescriptor().getPluginId(); + System.out.println(String.format("Extensions instances added by plugin '%s' for extension point '%s':", pluginId, Greeting.class.getName())); + List<Greeting> extensions = pluginManager.getExtensions(Greeting.class, pluginId); + for (Object extension : extensions) { + System.out.println(" " + extension); + } + } + + // print extensions instances from classpath (non plugin) + System.out.println("Extensions instances added by classpath:"); + List extensions = pluginManager.getExtensions((String) null); + for (Object extension : extensions) { + System.out.println(" " + extension); + } + + // print extensions instances for each started plugin + for (PluginWrapper plugin : startedPlugins) { + String pluginId = plugin.getDescriptor().getPluginId(); + System.out.println(String.format("Extensions instances added by plugin '%s':", pluginId)); + extensions = pluginManager.getExtensions(pluginId); + for (Object extension : extensions) { + System.out.println(" " + extension); + } + } + // stop the plugins pluginManager.stopPlugins(); /* |