File tree Expand file tree Collapse file tree 2 files changed +10
-19
lines changed
src/main/java/org/scijava/plugin Expand file tree Collapse file tree 2 files changed +10
-19
lines changed Original file line number Diff line number Diff line change 3131
3232package org .scijava .plugin ;
3333
34- import java .util .List ;
35-
3634import org .scijava .service .AbstractService ;
3735
3836/**
@@ -54,19 +52,4 @@ public abstract class AbstractPTService<PT extends SciJavaPlugin> extends
5452 public PluginService pluginService () {
5553 return pluginService ;
5654 }
57-
58- @ Override
59- public List <PluginInfo <PT >> getPlugins () {
60- return pluginService ().getPluginsOfType (getPluginType ());
61- }
62-
63- @ Override
64- public <P extends PT > P create (final Class <P > pluginClass ) {
65- final PluginInfo <PT > info =
66- pluginService ().getPlugin (pluginClass , getPluginType ());
67- @ SuppressWarnings ("unchecked" )
68- final P plugin = (P ) pluginService ().createInstance (info );
69- return plugin ;
70- }
71-
7255}
Original file line number Diff line number Diff line change @@ -90,13 +90,21 @@ public interface PTService<PT extends SciJavaPlugin> extends Service {
9090 PluginService pluginService ();
9191
9292 /** Gets the plugins managed by this service. */
93- List <PluginInfo <PT >> getPlugins ();
93+ default List <PluginInfo <PT >> getPlugins () {
94+ return pluginService ().getPluginsOfType (getPluginType ());
95+ }
9496
9597 /** Gets the type of plugins managed by this service. */
9698 Class <PT > getPluginType ();
9799
98100 /** Creates an instance of the given plugin class. */
99- <P extends PT > P create (final Class <P > pluginClass );
101+ default <P extends PT > P create (final Class <P > pluginClass ) {
102+ final PluginInfo <PT > info =
103+ pluginService ().getPlugin (pluginClass , getPluginType ());
104+ @ SuppressWarnings ("unchecked" )
105+ final P plugin = (P ) pluginService ().createInstance (info );
106+ return plugin ;
107+ }
100108
101109 // -- Deprecated methods --
102110
You can’t perform that action at this time.
0 commit comments