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 classResourceZoneRulesDataProvider.ResourceZoneRulesVersionVersion of the rules.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringgroupIDThe group ID.private java.util.Set<java.lang.String>regionsAll the regions in the provider.private java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object>rulesThe rules.private java.util.Set<ZoneRulesVersion>versionsAll the versions in the provider.
-
Constructor Summary
Constructors Modifier Constructor Description privateResourceZoneRulesDataProvider(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.StringgetGroupID()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 voidload()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) ZoneRulesloadRule(short index)Loads the rule.java.lang.StringtoString()
-
-
-
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.IOExceptionLoads 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.ClassNotFoundExceptionjava.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:
getGroupIDin 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:
getVersionsin 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:
getRegionIDsin 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:
toStringin classjava.lang.Object
-
-