jackcorless / jspf

Automatically exported from code.google.com/p/jspf
0 stars 0 forks source link

return Collection of added plugins from PluginManager.addPluginsFrom (instead of void) #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am wondering if there is any particular reason why the return object of 
PluginManager.addPluginsFrom is currently 'void'?
It would be useful if PluginManager.addPluginsFrom returns a Collection of 
added Plugins so the programmer can store them for later internal use, or use 
them immediately. 

I am aware of PluginMangerUtils.getPlugins but sometimes there would be too 
much hassle to filter out an specific plugin from that list, especially when 
there are multiple implementations of a plugin interface.

I believe that the suggested change in the API will be non intrusive, because 
no change would be necessary in any existing code which uses this method.

Kind regards,

Original issue reported on code.google.com by shah...@gmail.com on 29 Aug 2011 at 9:02

GoogleCodeExporter commented 8 years ago
Good point. In the current download version the return type is indeed void. In 
the latest Mercurial version I changed the return type to PluginManager to 
allow for "chaining" the method calls, but it appears to me that obtaining the 
loaded plugins is something quite some people want. 

The only thing I'm not certain about is if it will be really done as the return 
value:

Collection<Plugin> rval = pm.addPlugins(...)

or by specifying an option:

OptionLoadedPlugins loaded = new OptionLoadedPluging()
pm.addPlugins(..., loaded)
loaded.get()

Original comment by r.biedert on 29 Aug 2011 at 9:27