当前位置: 首页>>代码示例>>Java>>正文


Java Service类代码示例

本文整理汇总了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;
}
 
开发者ID:scifio,项目名称:scifio,代码行数:13,代码来源:DependencyException.java

示例2: isInjectable

import org.scijava.service.Service; //导入依赖的package包/类
private static boolean isInjectable(final Class<?> type) {
	return Service.class.isAssignableFrom(type) || //
		Context.class.isAssignableFrom(type);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:5,代码来源:OpUtils.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-omero,代码行数:49,代码来源:ScriptGeneratorTest.java

示例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;
}
 
开发者ID:scifio,项目名称:scifio,代码行数:9,代码来源:DependencyException.java


注:本文中的org.scijava.service.Service类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。