本文整理了Java中java.util.ServiceLoader.loadFromSystemProperty()
方法的一些代码示例,展示了ServiceLoader.loadFromSystemProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ServiceLoader.loadFromSystemProperty()
方法的具体详情如下:
包路径:java.util.ServiceLoader
类名称:ServiceLoader
方法名:loadFromSystemProperty
[英]Internal API to support built-in SPIs that check a system property first. Returns an instance specified by a property with the class' binary name, or null if no such property is set.
[中]支持先检查系统属性的内置SPI的内部API。返回由具有类的二进制名称的属性指定的实例,如果未设置此类属性,则返回null。
代码示例来源:origin: robovm/robovm
private static PreferencesFactory findPreferencesFactory() {
// Try the system property first...
PreferencesFactory result = ServiceLoader.loadFromSystemProperty(PreferencesFactory.class);
if (result != null) {
return result;
}
// Then use ServiceLoader for META-INF/services/...
for (PreferencesFactory impl : ServiceLoader.load(PreferencesFactory.class)) {
return impl;
}
// Finally return a default...
return new FilePreferencesFactoryImpl();
}
代码示例来源:origin: robovm/robovm
/**
* Gets a provider instance by executing the following steps when called for
* the first time:
* <ul>
* <li> if the system property "java.nio.channels.spi.SelectorProvider" is
* set, the value of this property is the class name of the provider
* returned; </li>
* <li>if there is a provider-configuration file named
* "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar
* file valid in the system class loader, the first class name is the
* provider's class name; </li>
* <li> otherwise, a system default provider will be returned.</li>
* </ul>
*
* @return the provider.
*/
synchronized public static SelectorProvider provider() {
if (provider == null) {
provider = ServiceLoader.loadFromSystemProperty(SelectorProvider.class);
if (provider == null) {
provider = loadProviderByJar();
}
if (provider == null) {
provider = new SelectorProviderImpl();
}
}
return provider;
}
代码示例来源:origin: com.bugvm/bugvm-rt
private static PreferencesFactory findPreferencesFactory() {
// Try the system property first...
PreferencesFactory result = ServiceLoader.loadFromSystemProperty(PreferencesFactory.class);
if (result != null) {
return result;
}
// Then use ServiceLoader for META-INF/services/...
for (PreferencesFactory impl : ServiceLoader.load(PreferencesFactory.class)) {
return impl;
}
// Finally return a default...
return new FilePreferencesFactoryImpl();
}
代码示例来源:origin: MobiVM/robovm
private static PreferencesFactory findPreferencesFactory() {
// Try the system property first...
PreferencesFactory result = ServiceLoader.loadFromSystemProperty(PreferencesFactory.class);
if (result != null) {
return result;
}
// Then use ServiceLoader for META-INF/services/...
for (PreferencesFactory impl : ServiceLoader.load(PreferencesFactory.class)) {
return impl;
}
// Finally return a default...
return new FilePreferencesFactoryImpl();
}
代码示例来源:origin: FlexoVM/flexovm
private static PreferencesFactory findPreferencesFactory() {
// Try the system property first...
PreferencesFactory result = ServiceLoader.loadFromSystemProperty(PreferencesFactory.class);
if (result != null) {
return result;
}
// Then use ServiceLoader for META-INF/services/...
for (PreferencesFactory impl : ServiceLoader.load(PreferencesFactory.class)) {
return impl;
}
// Finally return a default...
return new FilePreferencesFactoryImpl();
}
代码示例来源:origin: com.gluonhq/robovm-rt
private static PreferencesFactory findPreferencesFactory() {
// Try the system property first...
PreferencesFactory result = ServiceLoader.loadFromSystemProperty(PreferencesFactory.class);
if (result != null) {
return result;
}
// Then use ServiceLoader for META-INF/services/...
for (PreferencesFactory impl : ServiceLoader.load(PreferencesFactory.class)) {
return impl;
}
// Finally return a default...
return new FilePreferencesFactoryImpl();
}
代码示例来源:origin: ibinti/bugvm
private static PreferencesFactory findPreferencesFactory() {
// Try the system property first...
PreferencesFactory result = ServiceLoader.loadFromSystemProperty(PreferencesFactory.class);
if (result != null) {
return result;
}
// Then use ServiceLoader for META-INF/services/...
for (PreferencesFactory impl : ServiceLoader.load(PreferencesFactory.class)) {
return impl;
}
// Finally return a default...
return new FilePreferencesFactoryImpl();
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
private static PreferencesFactory findPreferencesFactory() {
// Try the system property first...
PreferencesFactory result = ServiceLoader.loadFromSystemProperty(PreferencesFactory.class);
if (result != null) {
return result;
}
// Then use ServiceLoader for META-INF/services/...
for (PreferencesFactory impl : ServiceLoader.load(PreferencesFactory.class)) {
return impl;
}
// Finally return a default...
return new FilePreferencesFactoryImpl();
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Gets a provider instance by executing the following steps when called for
* the first time:
* <ul>
* <li> if the system property "java.nio.channels.spi.SelectorProvider" is
* set, the value of this property is the class name of the provider
* returned; </li>
* <li>if there is a provider-configuration file named
* "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar
* file valid in the system class loader, the first class name is the
* provider's class name; </li>
* <li> otherwise, a system default provider will be returned.</li>
* </ul>
*
* @return the provider.
*/
synchronized public static SelectorProvider provider() {
if (provider == null) {
provider = ServiceLoader.loadFromSystemProperty(SelectorProvider.class);
if (provider == null) {
provider = loadProviderByJar();
}
if (provider == null) {
provider = new SelectorProviderImpl();
}
}
return provider;
}
代码示例来源:origin: MobiVM/robovm
/**
* Gets a provider instance by executing the following steps when called for
* the first time:
* <ul>
* <li> if the system property "java.nio.channels.spi.SelectorProvider" is
* set, the value of this property is the class name of the provider
* returned; </li>
* <li>if there is a provider-configuration file named
* "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar
* file valid in the system class loader, the first class name is the
* provider's class name; </li>
* <li> otherwise, a system default provider will be returned.</li>
* </ul>
*
* @return the provider.
*/
synchronized public static SelectorProvider provider() {
if (provider == null) {
provider = ServiceLoader.loadFromSystemProperty(SelectorProvider.class);
if (provider == null) {
provider = loadProviderByJar();
}
if (provider == null) {
provider = new SelectorProviderImpl();
}
}
return provider;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Gets a provider instance by executing the following steps when called for
* the first time:
* <ul>
* <li> if the system property "java.nio.channels.spi.SelectorProvider" is
* set, the value of this property is the class name of the provider
* returned; </li>
* <li>if there is a provider-configuration file named
* "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar
* file valid in the system class loader, the first class name is the
* provider's class name; </li>
* <li> otherwise, a system default provider will be returned.</li>
* </ul>
*
* @return the provider.
*/
synchronized public static SelectorProvider provider() {
if (provider == null) {
provider = ServiceLoader.loadFromSystemProperty(SelectorProvider.class);
if (provider == null) {
provider = loadProviderByJar();
}
if (provider == null) {
provider = new SelectorProviderImpl();
}
}
return provider;
}
代码示例来源:origin: ibinti/bugvm
/**
* Gets a provider instance by executing the following steps when called for
* the first time:
* <ul>
* <li> if the system property "java.nio.channels.spi.SelectorProvider" is
* set, the value of this property is the class name of the provider
* returned; </li>
* <li>if there is a provider-configuration file named
* "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar
* file valid in the system class loader, the first class name is the
* provider's class name; </li>
* <li> otherwise, a system default provider will be returned.</li>
* </ul>
*
* @return the provider.
*/
synchronized public static SelectorProvider provider() {
if (provider == null) {
provider = ServiceLoader.loadFromSystemProperty(SelectorProvider.class);
if (provider == null) {
provider = loadProviderByJar();
}
if (provider == null) {
provider = new SelectorProviderImpl();
}
}
return provider;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Gets a provider instance by executing the following steps when called for
* the first time:
* <ul>
* <li> if the system property "java.nio.channels.spi.SelectorProvider" is
* set, the value of this property is the class name of the provider
* returned; </li>
* <li>if there is a provider-configuration file named
* "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar
* file valid in the system class loader, the first class name is the
* provider's class name; </li>
* <li> otherwise, a system default provider will be returned.</li>
* </ul>
*
* @return the provider.
*/
synchronized public static SelectorProvider provider() {
if (provider == null) {
provider = ServiceLoader.loadFromSystemProperty(SelectorProvider.class);
if (provider == null) {
provider = loadProviderByJar();
}
if (provider == null) {
provider = new SelectorProviderImpl();
}
}
return provider;
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Gets a provider instance by executing the following steps when called for
* the first time:
* <ul>
* <li> if the system property "java.nio.channels.spi.SelectorProvider" is
* set, the value of this property is the class name of the provider
* returned; </li>
* <li>if there is a provider-configuration file named
* "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar
* file valid in the system class loader, the first class name is the
* provider's class name; </li>
* <li> otherwise, a system default provider will be returned.</li>
* </ul>
*
* @return the provider.
*/
synchronized public static SelectorProvider provider() {
if (provider == null) {
provider = ServiceLoader.loadFromSystemProperty(SelectorProvider.class);
if (provider == null) {
provider = loadProviderByJar();
}
if (provider == null) {
provider = new SelectorProviderImpl();
}
}
return provider;
}
内容来源于网络,如有侵权,请联系作者删除!