本文整理汇总了Java中org.scijava.service.Service类的典型用法代码示例。如果您正苦于以下问题:Java Service类的具体用法?Java Service怎么用?Java Service使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Service类属于org.scijava.service包,在下文中一共展示了Service类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DependencyException
import org.scijava.service.Service; //导入依赖的package包/类
/**
* Default constructor.
*
* @param message Error message.
* @param klass Failed instantiation class.
*/
public DependencyException(final String message,
final Class<? extends Service> klass)
{
super(message);
this.failureClass = klass;
}
示例2: isInjectable
import org.scijava.service.Service; //导入依赖的package包/类
private static boolean isInjectable(final Class<?> type) {
return Service.class.isAssignableFrom(type) || //
Context.class.isAssignableFrom(type);
}
示例3: testGenerateAll
import org.scijava.service.Service; //导入依赖的package包/类
@Test
public void testGenerateAll() throws IOException {
// create a context with a minimal command set
final PluginIndex pluginIndex = new PluginIndex() {
@Override
public void discover() {
super.discover();
removeAll(getPlugins(Command.class));
add(pluginInfo(FileNew.class));
add(pluginInfo(FileOpen.class));
add(pluginInfo(FileSave.class));
add(pluginInfo(FileExit.class));
add(pluginInfo(Lion.class));
add(pluginInfo(Tiger.class));
add(pluginInfo(Bear.class));
}
};
final ArrayList<Class<? extends Service>> classes =
new ArrayList<Class<? extends Service>>();
classes.add(AppService.class);
classes.add(CommandService.class);
classes.add(MenuService.class);
final Context context = new Context(classes, pluginIndex);
final ScriptGenerator scriptGen = new ScriptGenerator(context);
final File tempDir =
TestUtils.createTemporaryDirectory("script-generator-");
final File libDir = new File(tempDir, "lib");
final File scriptsDir = new File(libDir, "scripts");
assertTrue(scriptsDir.mkdirs());
final int returnCode = scriptGen.generateAll(tempDir);
context.dispose();
assertEquals(0, returnCode);
final File imagejDir = new File(scriptsDir, "imagej");
assertTrue(imagejDir.isDirectory());
final File fileDir = new File(imagejDir, "File");
assertTrue(fileDir.isDirectory());
final File animalsDir = new File(imagejDir, "\ufeffAnimals");
assertTrue(animalsDir.isDirectory());
assertTrue(new File(fileDir, "New.py").exists());
assertTrue(new File(fileDir, "\ufeffOpen.py").exists());
assertTrue(new File(fileDir, "\ufeff\ufeffSave.py").exists());
assertTrue(new File(fileDir, "\ufeff\ufeff\ufeffExit.py").exists());
assertTrue(new File(animalsDir, "Lion.py").exists());
assertTrue(new File(animalsDir, "\ufeffTiger.py").exists());
assertTrue(new File(animalsDir, "\ufeff\ufeffBear.py").exists());
FileUtils.deleteRecursively(tempDir);
}
示例4: getFailureClass
import org.scijava.service.Service; //导入依赖的package包/类
/**
* Returns the class that was used during a failed instantiation.
*
* @return See above.
*/
public Class<? extends Service> getFailureClass() {
return failureClass;
}