gpt4 book ai didi

org.threeten.bp.zone.ZoneRulesInitializer类的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 03:44:31 26 4
gpt4 key购买 nike

本文整理了Java中org.threeten.bp.zone.ZoneRulesInitializer类的一些代码示例,展示了ZoneRulesInitializer类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneRulesInitializer类的具体详情如下:
包路径:org.threeten.bp.zone.ZoneRulesInitializer
类名称:ZoneRulesInitializer

ZoneRulesInitializer介绍

[英]Controls how the time-zone rules are initialized.

The default behavior is to use ServiceLoader to find instances of ZoneRulesProvider. Use the #setInitializer(ZoneRulesInitializer) method to replace this behavior. The initializer instance must perform the work of creating the ZoneRulesProvider within the #initializeProviders() method to ensure that the provider is not initialized too early.

The initializer must be set before class loading of any other ThreeTen-Backport class to have any effect!

This class has been added primarily for the benefit of Android.
[中]控制时区规则的初始化方式。
默认行为是使用ServiceLoader查找ZoneRulesProvider的实例。使用#setInitializer(ZoneRulesInitializer)方法替换此行为。initializer实例必须在#initializeProviders()方法中执行创建ZoneRulesProvider的工作,以确保不会过早初始化提供程序。
初始化器必须在加载任何其他Three-Ten Backport类之前设置才能生效!
添加这个类主要是为了Android的好处。

代码示例

代码示例来源:origin: JakeWharton/ThreeTenABP

public static void init(Context context) {
 if (!initialized.getAndSet(true)) {
  ZoneRulesInitializer.setInitializer(new AssetsZoneRulesInitializer(context));
 }
}

代码示例来源:origin: ThreeTen/threetenbp

static void initialize() {
  if (INITIALIZED.getAndSet(true)) {
    throw new IllegalStateException("Already initialized");
  }
  // Set the default initializer if none has been provided yet.
  INITIALIZER.compareAndSet(null, new ServiceLoaderZoneRulesInitializer());
  INITIALIZER.get().initializeProviders();
}

代码示例来源:origin: org.threeten/threetenbp

static void initialize() {
  if (INITIALIZED.getAndSet(true)) {
    throw new IllegalStateException("Already initialized");
  }
  // Set the default initializer if none has been provided yet.
  INITIALIZER.compareAndSet(null, new ServiceLoaderZoneRulesInitializer());
  INITIALIZER.get().initializeProviders();
}

代码示例来源:origin: gabrielittner/lazythreetenbp

/**
 * Initialize threetenbp to use LazyThreeTenBp's ZoneRulesProvider
 */
@MainThread
public static void init(Context context) {
  if (INITIALIZED.getAndSet(true)) {
    return;
  }
  ZoneRulesInitializer.setInitializer(
      new LazyZoneRulesInitializer((Application) context.getApplicationContext()));
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com