本文整理汇总了Java中org.scijava.module.ModuleService类的典型用法代码示例。如果您正苦于以下问题:Java ModuleService类的具体用法?Java ModuleService怎么用?Java ModuleService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleService类属于org.scijava.module包,在下文中一共展示了ModuleService类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveModules
import org.scijava.module.ModuleService; //导入依赖的package包/类
@Test
public void retrieveModules() {
final List<?> res = resources.client().target("/modules").request().get(
List.class);
final HashSet<?> ids = new HashSet<>(res);
final List<ModuleInfo> mInfos = ctx.getService(ModuleService.class)
.getModules();
for (final ModuleInfo mInfo : mInfos) {
final String id = ((Identifiable) mInfo).getIdentifier();
assertTrue(ids.contains(id));
ids.remove(id);
}
assertTrue(ids.isEmpty());
}
示例2: getWidget
import org.scijava.module.ModuleService; //导入依赖的package包/类
@Test
public void getWidget() {
final String[] ids = { "command:net.imagej.server.external.ScriptEval",
"command:net.imagej.server.ModulesResourceTest$Bar" };
for (final String id : ids) {
final String response = resources.client().target("/modules/" + id)
.request().get(String.class);
String expected;
try {
expected = jsonService.parseObject(ctx.getService(ModuleService.class)
.getModuleById(id));
assertEquals(expected, response);
}
catch (JsonProcessingException exc) {
fail(exc.getMessage());
}
}
}
示例3: findModule
import org.scijava.module.ModuleService; //导入依赖的package包/类
/** Looks up an {@link Identifiable} ImageJ module by its identifier. */
public static ModuleInfo findModule(final ModuleService moduleService,
final String id)
{
// TODO: Migrate logic to ModuleService, and cache identifiers in a hash.
for (final ModuleInfo info : moduleService.getModules()) {
if (!(info instanceof Identifiable)) continue;
final String infoID = ((Identifiable) info).getIdentifier();
if (id.equals(infoID)) return info;
}
throw new IllegalArgumentException("No module for ID: " + id);
}