AdministrativeRulesLoader (API Reference)
Class AdministrativeRulesLoader
Provides the interface for the access to the administrative rules available for a country or a state in the local OCM map. Please be aware that the methods within this classload map data synchronously. In the event of absent data in the disk cache, the data will be retrieved from the remote server. To mitigate the potential freezing of the calling thread, it is advisable to proactively prefetch map data around the working area.
Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of this class.AdministrativeRulesLoader(SDKNativeEngine sdkEngine) Creates a new instance of this class. -
Method Summary
Modifier and TypeMethodDescriptiongetAdministrativeRules(CountryCode countryCode, String stateCode) Synchronously load the administrative rules for the specified country and state.getStateCodes(CountryCode countryCode) Synchronously loads the list of state codes from a specified country for which administrative rules are availabe.
-
Constructor Details
-
AdministrativeRulesLoader
Creates a new instance of this class.
- Throws:
InstantiationErrorException-Indicates what went wrong when the instantiation was attempted.
-
AdministrativeRulesLoader
public AdministrativeRulesLoader(@NonNull SDKNativeEngine sdkEngine) throws InstantiationErrorException Creates a new instance of this class.
- Parameters:
sdkEngine-A SDKEngine instance.
- Throws:
InstantiationErrorException-Indicates what went wrong when the instantiation was attempted.
-
-
Method Details
-
getStateCodes
@NonNull public List<String> getStateCodes(@NonNull CountryCode countryCode) throws MapDataLoaderException Synchronously loads the list of state codes from a specified country for which administrative rules are availabe. These state codes can then be used to get specific administrative rules for a specified state using the
get_administrative_rules()method. Returns a list with all the state codes available in the country. In case the country has no states, the list will be empty.- Parameters:
countryCode-The country code for which the state codes are going to be retrieved.
- Returns:
The list of state codes present in the country for which administrative rules are available. Throws if it's not possible to return the list of state codes.
- Throws:
MapDataLoaderException-Specifies reason, why the list of state codes was not returned.
-
getAdministrativeRules
@NonNull public AdministrativeRules getAdministrativeRules(@NonNull CountryCode countryCode, @Nullable String stateCode) throws MapDataLoaderException Synchronously load the administrative rules for the specified country and state. Note: The
state_codeparameter can be set tonull. In this case, even if the country has multiple states, each with their own administrative rules, anAdministrativeRulesobject will be returned, containing the administrative rules valid for the entire country. These rules can however be overwritten by the state rules when the driver is in that specific state, so it is recommended to always retrieve the rules for a specific state for higher accuracy. Returns anAdministrativeRulesobject which contains the administrative rules for the specified country and state.- Parameters:
countryCode-The country code for which the administrative rules will be retrieved.
stateCode-The state name for which the administrative rules will be received. It can be
null.- Returns:
Requested administrative rules for the country and the state specified.
- Throws:
MapDataLoaderException-Specifies reason, why the administrative rules were not retrieved.
-