Class RulesLoader

  • All Implemented Interfaces:

    
    public class RulesLoader
    
                        

    Facilitates the download and caching of rules from a url as well as an asset bundled with the app.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final String cacheName
    • Constructor Summary

      Constructors 
      Constructor Description
      RulesLoader(String cacheName)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

      • RulesLoader

        RulesLoader(String cacheName)
    • Method Detail

      • getCacheName

        @NonNull() String getCacheName()

        Gets the cache name that will be used for storing and retrieving the rules when using operations of this class.

        Returns:

        cache name that will be used for storing and retrieving the rules.

      • loadFromUrl

         void loadFromUrl(@NonNull() String url, @NonNull() AdobeCallback<RulesLoadResult> callback)

        Loads rules from the url and invokes callback with the extracted rules. Additionally, the extracted content is cached in cache bucket with name name and url as the key in CacheService.

        Parameters:
        url - the url from which the compressed rules are to be downloaded
        callback - the callback that will be invoked with the result of the download
      • loadFromAsset

        @NonNull() RulesLoadResult loadFromAsset(@NonNull() String assetName)

        Loads rules from an asset bundled with the app and returns the extracted rules. Additionally, the extracted content is cached in cache bucket with name RulesLoader.getCacheName() and assetName as the key in CacheService.

        Parameters:
        assetName - the asset name from where the rules must be fetched
        Returns:

        RulesDownloadResult indicating the result of the load operation.

      • loadFromCache

        @NonNull() RulesLoadResult loadFromCache(@NonNull() String key)

        Loads rules that were previously cached via loadFromAsset() or loadFromUrl

        Parameters:
        key - the asset name or url that was previously used for loading and storing rules via loadFromAsset() or loadFromUrl
        Returns:

        RulesDownloadResult indicating the result of the load operation.