本文整理了Java中java.util.ServiceLoader.findFirst()
方法的一些代码示例,展示了ServiceLoader.findFirst()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ServiceLoader.findFirst()
方法的具体详情如下:
包路径:java.util.ServiceLoader
类名称:ServiceLoader
方法名:findFirst
暂无
代码示例来源:origin: be.yildiz-games/module-graphic
public static BaseGraphicEngine getEngine(BaseWindowEngine windowEngine) {
ServiceLoader<GraphicEngineProvider> provider = ServiceLoader.load(GraphicEngineProvider.class);
return provider.findFirst().orElseGet(DummyGraphicEngineProvider::new).getEngine(windowEngine);
}
代码示例来源:origin: be.yildiz-games/module-window
static BaseWindowEngine getEngine() {
ServiceLoader<WindowEngineProvider> provider = ServiceLoader.load(WindowEngineProvider.class);
return provider.findFirst().orElseGet(DummyWindowEngineProvider::new).getEngine();
}
}
代码示例来源:origin: be.yildiz-games/module-audio
public static BaseAudioEngine getEngine() {
ServiceLoader<AudioEngineProvider> provider = ServiceLoader.load(AudioEngineProvider.class);
return provider.findFirst().orElseGet(DummyAudioEngineProvider::new).getAudioEngine();
}
代码示例来源:origin: be.yildiz-games/module-physics
public static BasePhysicEngine getEngine() {
ServiceLoader<PhysicEngineProvider> provider = ServiceLoader.load(PhysicEngineProvider.class);
return provider.findFirst().orElseGet(DummyPhysicEngineProvider::new).getPhysicEngine();
}
代码示例来源:origin: be.yildiz-games/module-scripting
public static ScriptInterpreter getEngine() {
ServiceLoader<ScriptInterpreterProvider> provider = ServiceLoader.load(ScriptInterpreterProvider.class);
return provider.findFirst().orElseGet(NoInterpreterProvider::new).getInterpreter();
}
代码示例来源:origin: be.yildiz-games/module-network
public static Server getEngine() {
ServiceLoader<ServerProvider> provider = ServiceLoader.load(ServerProvider.class);
return provider.findFirst().orElseGet(DummyServerProvider::new).getEngine();
}
代码示例来源:origin: be.yildiz-games/module-network
public static Client getEngine() {
ServiceLoader<ClientProvider> provider = ServiceLoader.load(ClientProvider.class);
return provider.findFirst().orElseGet(DummyClientProvider::new).getEngine();
}
代码示例来源:origin: be.yildiz-games/module-graphic
public static BaseGraphicEngine getEngine() {
ServiceLoader<GraphicEngineProvider> provider = ServiceLoader.load(GraphicEngineProvider.class);
return provider.findFirst().orElseGet(DummyGraphicEngineProvider::new).getEngine(BaseWindowEngine.getEngine());
}
代码示例来源:origin: com.io7m.minisite/com.io7m.minisite.maven_plugin
config.changelog().ifPresent(changes_config -> {
final Optional<CXMLChangelogParserProviderType> parser_provider_opt =
ServiceLoader.load(CXMLChangelogParserProviderType.class).findFirst();
ServiceLoader.load(CAtomChangelogWriterProviderType.class).findFirst();
内容来源于网络,如有侵权,请联系作者删除!