Skip to content

Commit 6068427

Browse files
committed
Update getCommand/PluginOfClass javadoc
Clarified that class equality is tested is by name and not assignability, and pointed to get...OfType as an alternative for finding multiple implementations of a given command or plugin.
1 parent 1b8454b commit 6068427

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/main/java/org/scijava/command/CommandService.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ <CT extends Command> List<CommandInfo> getCommands(
9292
* Most classes will have only a single match, but some special classes (such
9393
* as ImageJ's {@code LegacyCommand}) may match many entries.
9494
* </p>
95+
* <p>
96+
* NB: Classes are matched by strict equality, not assignability; subtypes of
97+
* the specified class will not match. For this behavior, use
98+
* {@link #getCommandsOfType(Class)} on a common parent interface.
99+
* </p>
95100
*/
96101
<C extends Command> List<CommandInfo> getCommandsOfClass(
97102
Class<C> commandClass);
@@ -102,6 +107,11 @@ <C extends Command> List<CommandInfo> getCommandsOfClass(
102107
* Most classes will have only a single match, but some special classes (such
103108
* as ImageJ's {@code LegacyCommand}) may match many entries.
104109
* </p>
110+
* <p>
111+
* NB: Classes are matched by strict equality, not assignability; subtypes of
112+
* the specified class will not match. For this behavior, use
113+
* {@link #getCommandsOfType(Class)} on a common parent interface.
114+
* </p>
105115
*/
106116
List<CommandInfo> getCommandsOfClass(String className);
107117

src/main/java/org/scijava/plugin/PluginService.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ public interface PluginService extends SciJavaService {
121121
* class <em>names</em> to load their plugin {@link Class}es so that they can
122122
* be compared with the given one.
123123
* </p>
124+
* <p>
125+
* NB: Classes are matched by strict equality, not assignability; subtypes of
126+
* the specified class will not match. For this behavior, use
127+
* {@link #getPluginsOfType(Class)} on a common parent interface.
128+
* </p>
124129
*
125130
* @param <P> The <em>class</em> of plugins to look up.
126131
* @param pluginClass The class for which to obtain the list of matching
@@ -140,6 +145,11 @@ public interface PluginService extends SciJavaService {
140145
* class <em>names</em> and types to load their plugin {@link Class}es so that
141146
* they can be compared with the given one.
142147
* </p>
148+
* <p>
149+
* NB: Classes are matched by strict equality, not assignability; subtypes of
150+
* the specified class will not match. For this behavior, use
151+
* {@link #getPluginsOfType(Class)} on a common parent interface.
152+
* </p>
143153
*
144154
* @param <PT> The <em>type</em> of plugins to look up; e.g.,
145155
* {@code Service.class}.
@@ -158,6 +168,11 @@ public interface PluginService extends SciJavaService {
158168
* Most classes will have only a single match, but some special classes (such
159169
* as ImageJ's {@code LegacyCommand}) may match many entries.
160170
* </p>
171+
* <p>
172+
* NB: Classes are matched by strict equality, not assignability; subtypes of
173+
* the specified class will not match. For this behavior, use
174+
* {@link #getPluginsOfType(Class)} on a common parent interface.
175+
* </p>
161176
*
162177
* @param className The class name for which to obtain the list of matching
163178
* plugins.
@@ -170,6 +185,11 @@ public interface PluginService extends SciJavaService {
170185
* Most classes will have only a single match, but some special classes (such
171186
* as ImageJ's {@code LegacyCommand}) may match many entries.
172187
* </p>
188+
* <p>
189+
* NB: Classes are matched by strict equality, not assignability; subtypes of
190+
* the specified class will not match. For this behavior, use
191+
* {@link #getPluginsOfType(Class)} on a common parent interface.
192+
* </p>
173193
*
174194
* @param <PT> The <em>type</em> of plugins to look up; e.g.,
175195
* {@code Service.class}.

0 commit comments

Comments
 (0)