Package javax.time.calendar.zone
Class ResourceZoneRulesDataProvider
- java.lang.Object
-
- javax.time.calendar.zone.ResourceZoneRulesDataProvider
-
- All Implemented Interfaces:
ZoneRulesDataProvider
final class ResourceZoneRulesDataProvider extends java.lang.Object implements ZoneRulesDataProvider
Loads time-zone rules stored in a file accessed via class loader.ResourceZoneRulesDataProvider is thread-safe and immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ResourceZoneRulesDataProvider.ResourceZoneRulesVersion
Version of the rules.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
groupID
The group ID.private java.util.Set<java.lang.String>
regions
All the regions in the provider.private java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object>
rules
The rules.private java.util.Set<ZoneRulesVersion>
versions
All the versions in the provider.
-
Constructor Summary
Constructors Modifier Constructor Description private
ResourceZoneRulesDataProvider(java.net.URL url)
Loads the rules from a URL, often in a jar file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getGroupID()
Gets the time-zone group ID of the data available via this provider, such as 'TZDB'.java.util.Set<java.lang.String>
getRegionIDs()
Gets the provided region IDs.java.util.Set<ZoneRulesVersion>
getVersions()
Gets the provided rules, version by version.(package private) static void
load()
Loads any time-zone rules data stored in files.private static java.util.List<ResourceZoneRulesDataProvider>
loadResources()
Loads the rules from files in the class loader, often jar files.(package private) ZoneRules
loadRule(short index)
Loads the rule.java.lang.String
toString()
-
-
-
Field Detail
-
groupID
private final java.lang.String groupID
The group ID.
-
versions
private final java.util.Set<ZoneRulesVersion> versions
All the versions in the provider.
-
regions
private final java.util.Set<java.lang.String> regions
All the regions in the provider.
-
rules
private final java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object> rules
The rules.
-
-
Constructor Detail
-
ResourceZoneRulesDataProvider
private ResourceZoneRulesDataProvider(java.net.URL url) throws java.lang.ClassNotFoundException, java.io.IOException
Loads the rules from a URL, often in a jar file.- Parameters:
providers
- the list to add to, not nullurl
- the jar file to load, not null- Throws:
java.lang.Exception
- if an error occursjava.lang.ClassNotFoundException
java.io.IOException
-
-
Method Detail
-
load
static void load()
Loads any time-zone rules data stored in files.- Throws:
java.lang.RuntimeException
- if the time-zone rules cannot be loaded
-
loadResources
private static java.util.List<ResourceZoneRulesDataProvider> loadResources()
Loads the rules from files in the class loader, often jar files.- Returns:
- the list of loaded rules, never null
- Throws:
java.lang.Exception
- if an error occurs
-
getGroupID
public java.lang.String getGroupID()
Gets the time-zone group ID of the data available via this provider, such as 'TZDB'.Group IDs must match regex
[A-Za-z0-9._-]+
. Group IDs should use reverse domain name notation, like packages. Group IDs without a dot are reserved.- Specified by:
getGroupID
in interfaceZoneRulesDataProvider
- Returns:
- the ID of the group, never null
-
getVersions
public java.util.Set<ZoneRulesVersion> getVersions()
Gets the provided rules, version by version.- Specified by:
getVersions
in interfaceZoneRulesDataProvider
- Returns:
- the provided rules, not to be modified, never null
-
getRegionIDs
public java.util.Set<java.lang.String> getRegionIDs()
Gets the provided region IDs.- Specified by:
getRegionIDs
in interfaceZoneRulesDataProvider
- Returns:
- the provided region IDs, not to be modified, never null
-
loadRule
ZoneRules loadRule(short index) throws java.lang.Exception
Loads the rule.- Parameters:
index
- the index to retrieve- Returns:
- the rules, should not be null
- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-