本文整理汇总了Java中java.util.spi.ResourceBundleControlProvider类的典型用法代码示例。如果您正苦于以下问题:Java ResourceBundleControlProvider类的具体用法?Java ResourceBundleControlProvider怎么用?Java ResourceBundleControlProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceBundleControlProvider类属于java.util.spi包,在下文中一共展示了ResourceBundleControlProvider类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: current
import java.util.spi.ResourceBundleControlProvider; //导入依赖的package包/类
public Provider current() {
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
if (tccl == null) {
tccl = getSystemClassLoader();
}
while (tccl != null) {
final ResourceBundleControlProvider impl = providers.get(tccl);
if (impl != null) {
return new Provider(impl, tccl);
}
if (tccl == tccl.getParent()) {
return null;
}
tccl = tccl.getParent();
}
return null;
}
示例2: getDefaultControl
import java.util.spi.ResourceBundleControlProvider; //导入依赖的package包/类
private static Control getDefaultControl(String baseName) {
if (providers != null) {
for (ResourceBundleControlProvider provider : providers) {
Control control = provider.getControl(baseName);
if (control != null) {
return control;
}
}
}
return Control.INSTANCE;
}
示例3: getDefaultControl
import java.util.spi.ResourceBundleControlProvider; //导入依赖的package包/类
private static Control getDefaultControl(Class<?> caller, String baseName) {
if (providers != null && !caller.getModule().isNamed()) {
for (ResourceBundleControlProvider provider : providers) {
Control control = provider.getControl(baseName);
if (control != null) {
return control;
}
}
}
return Control.INSTANCE;
}
示例4: Provider
import java.util.spi.ResourceBundleControlProvider; //导入依赖的package包/类
Provider(final ResourceBundleControlProvider provider, final ClassLoader loader) {
this.provider = provider;
this.loader = loader;
}
示例5: getProvider
import java.util.spi.ResourceBundleControlProvider; //导入依赖的package包/类
public ResourceBundleControlProvider getProvider() {
return provider;
}
示例6: register
import java.util.spi.ResourceBundleControlProvider; //导入依赖的package包/类
/**
* @param loader
* the loader identifying the current context.
* @param customProvider
* the bundle control provider to associate with this loader.
* @return a callback to call when you don't need the custom provider anymore.
*/
public Runnable register(final ClassLoader loader, final ResourceBundleControlProvider customProvider) {
if (providers.putIfAbsent(loader, customProvider) != null) {
throw new IllegalArgumentException("A custom ResourceBundleControlProvider is already registered for " + loader);
}
return () -> providers.remove(loader, customProvider);
}