Class MillisecondStore
MillisecondStoreDataProvider.
The int constants in the CalendarKeys class represent the instances that are supported by default. It is also possible to register
your own implementation of MillisecondStoreDataProvider and register it.
The default calendar instance will be used when Year, Day and Instant methods do not specify a calendar instance. By default,
the default is EARTH. It is possible to set a different default.
Data will only be requested from a MillisecondStoreDataProvider when the mechanism needs it, so no eager loading is done. Whenever data is
requested, it is stored in a MillisecondStoreData object for repeated use, so MillisecondStoreDataProviders don't need to implement
caching themselves.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidClears allMillisecondStoreData, so that, upon the next call todata(int), the data is re-requested from theMillisecondStoreDataProvider.voidclearData(int key) Clears theMillisecondStoreDatacorresponding to the given key, so that, upon the next call todata(int)with that key, the data is re-requested from theMillisecondStoreDataProvider.static MillisecondStoreDatadata(int calendarKey) Shortcut method to callgetData(int)on the singletonINSTANCE.static intShortcut method to callgetDefaultCalendarKey()on the singletonINSTANCE.getData(int calendarKey) Gets theMillisecondStoreDatagenerated by theMillisecondStoreDataProviderwith the given key.intGet the default calendar key, for when no explicit calendar key is provided.voidregisterProvider(int key, MillisecondStoreDataProvider provider) Registers the givenMillisecondStoreDataProviderunder the given key.voidsetDefaultCalendarKey(int defaultCalendarKey) Set the default calendar key, for when no explicit calendar key is provided.static MillisecondStorestore()Gets the singleton instance of theMillisecondStore.
-
Method Details
-
store
Gets the singleton instance of theMillisecondStore. -
defaultCalendarKey
public static int defaultCalendarKey()Shortcut method to callgetDefaultCalendarKey()on the singletonINSTANCE. -
data
Shortcut method to callgetData(int)on the singletonINSTANCE. -
getDefaultCalendarKey
public int getDefaultCalendarKey()Get the default calendar key, for when no explicit calendar key is provided. -
setDefaultCalendarKey
public void setDefaultCalendarKey(int defaultCalendarKey) Set the default calendar key, for when no explicit calendar key is provided. -
registerProvider
Registers the givenMillisecondStoreDataProviderunder the given key. It is not advisable to overwrite the standard keys, i.e. the int constants in theCalendarKeysclass, as other classes might depend on those constants to represent what they are intended to represent. -
getData
Gets theMillisecondStoreDatagenerated by theMillisecondStoreDataProviderwith the given key.Data is requested from the
MillisecondStoreDataProvideronly once, after which it is stored for future use.- Throws:
LukashianException- when the given key is not mapped to aMillisecondStoreDataProvider
-
clearData
public void clearData(int key) Clears theMillisecondStoreDatacorresponding to the given key, so that, upon the next call todata(int)with that key, the data is re-requested from theMillisecondStoreDataProvider. -
clearAllData
public void clearAllData()Clears allMillisecondStoreData, so that, upon the next call todata(int), the data is re-requested from theMillisecondStoreDataProvider.
-