Tabnine Logo
ZoneRulesProvider.getRules
Code IndexAdd Tabnine to your IDE (free)

How to use
getRules
method
in
org.threeten.bp.zone.ZoneRulesProvider

Best Java code snippets using org.threeten.bp.zone.ZoneRulesProvider.getRules (Showing top 6 results out of 315)

origin: ThreeTen/threetenbp

@Override
public ZoneRules getRules() {
  // additional query for group provider when null allows for possibility
  // that the provider was added after the ZoneId was created
  return (rules != null ? rules : ZoneRulesProvider.getRules(id, false));
}
origin: org.threeten/threetenbp

@Override
public ZoneRules getRules() {
  // additional query for group provider when null allows for possibility
  // that the provider was added after the ZoneId was created
  return (rules != null ? rules : ZoneRulesProvider.getRules(id, false));
}
origin: gabrielittner/lazythreetenbp

private SortedMap<String, ZoneRules> generateZones(String... zoneIds) throws IOException {
  SortedMap<String, ZoneRules> zones = new TreeMap<>();
  for (String zoneId : zoneIds) {
    zones.put(zoneId, ZoneRulesProvider.getRules(zoneId, false));
  }
  zoneWriter.writeZones(zones);
  return zones;
}
origin: ThreeTen/threetenbp

/**
 * Obtains an instance of {@code ZoneId} from an identifier.
 *
 * @param zoneId  the time-zone ID, not null
 * @param checkAvailable  whether to check if the zone ID is available
 * @return the zone ID, not null
 * @throws DateTimeException if the ID format is invalid
 * @throws DateTimeException if checking availability and the ID cannot be found
 */
static ZoneRegion ofId(String zoneId, boolean checkAvailable) {
  Jdk8Methods.requireNonNull(zoneId, "zoneId");
  if (zoneId.length() < 2 || PATTERN.matcher(zoneId).matches() == false) {
    throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
  }
  ZoneRules rules = null;
  try {
    // always attempt load for better behavior after deserialization
    rules = ZoneRulesProvider.getRules(zoneId, true);
  } catch (ZoneRulesException ex) {
    // special case as removed from data file
    if (zoneId.equals("GMT0")) {
      rules = ZoneOffset.UTC.getRules();
    } else if (checkAvailable) {
      throw ex;
    }
  }
  return new ZoneRegion(zoneId, rules);
}
origin: org.threeten/threetenbp

/**
 * Obtains an instance of {@code ZoneId} from an identifier.
 *
 * @param zoneId  the time-zone ID, not null
 * @param checkAvailable  whether to check if the zone ID is available
 * @return the zone ID, not null
 * @throws DateTimeException if the ID format is invalid
 * @throws DateTimeException if checking availability and the ID cannot be found
 */
static ZoneRegion ofId(String zoneId, boolean checkAvailable) {
  Jdk8Methods.requireNonNull(zoneId, "zoneId");
  if (zoneId.length() < 2 || PATTERN.matcher(zoneId).matches() == false) {
    throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
  }
  ZoneRules rules = null;
  try {
    // always attempt load for better behavior after deserialization
    rules = ZoneRulesProvider.getRules(zoneId, true);
  } catch (ZoneRulesException ex) {
    // special case as removed from data file
    if (zoneId.equals("GMT0")) {
      rules = ZoneOffset.UTC.getRules();
    } else if (checkAvailable) {
      throw ex;
    }
  }
  return new ZoneRegion(zoneId, rules);
}
origin: gabrielittner/lazythreetenbp

/**
 * Call on background thread to eagerly load all zones. Starts with loading
 * {@link ZoneId#systemDefault()} which is the one most likely to be used.
 */
@WorkerThread
public static void cacheZones() {
  ZoneId.systemDefault().getRules();
  for (String zoneId : ZoneRulesProvider.getAvailableZoneIds()) {
    ZoneRulesProvider.getRules(zoneId, true);
  }
}
org.threeten.bp.zoneZoneRulesProvidergetRules

Javadoc

Gets the rules for the zone ID.

This returns the latest available rules for the zone ID.

This method relies on time-zone data provider files that are configured. These are loaded using a ServiceLoader.

The caching flag is designed to allow provider implementations to prevent the rules being cached in ZoneId. Under normal circumstances, the caching of zone rules is highly desirable as it will provide greater performance. However, there is a use case where the caching would not be desirable, see #provideRules.

Popular methods of ZoneRulesProvider

  • getAvailableZoneIds
    Gets the set of available zone IDs. These zone IDs are loaded and available for use by ZoneId.
  • registerProvider
    Registers a zone rules provider. This adds a new provider to those currently available. A provider s
  • getProvider
    Gets the provider for the zone ID.
  • provideRefresh
    SPI method to refresh the rules from the underlying data provider. This method provides the opportun
  • provideRules
    SPI method to get the rules for the zone ID. This loads the rules for the region and version specifi
  • provideVersions
    SPI method to get the history of rules for the zone ID. This returns a map of historical rules keyed
  • provideZoneIds
    SPI method to get the available zone IDs. This obtains the IDs that this ZoneRulesProvider provides.
  • registerProvider0
    Registers the provider.

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • JButton (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now