Class AudioDatabaseAdapter

java.lang.Object
yearreview.app.data.sources.audio.adapter.AudioDatabaseAdapter
Direct Known Subclasses:
SpotifyAdapter

public abstract class AudioDatabaseAdapter extends Object
Abstract class that defines how an adapter to an AudioDatabase should work.
Author:
ColdStone37
  • Field Details

    • database

      protected final AudioDatabase database
      Stores the database to insert the data into.
  • Constructor Details

    • AudioDatabaseAdapter

      public AudioDatabaseAdapter(AudioDatabase database)
      Constructs an adapter. A database must always be passed since it's needed to insert the data.
      Parameters:
      database - database to insert the data into
  • Method Details

    • getAdapter

      public static AudioDatabaseAdapter getAdapter(AudioDatabase database, XmlNode config)
      Creates a new Adapter by its name.
      Parameters:
      database - database to insert the data of the Adapter into
      config - configuration for the Adapter
      Returns:
      the constructed Adapter
    • loadData

      public abstract void loadData(Instant start, Instant end) throws IOException
      Loads the data of the Adapter and inserts it into the database.
      Parameters:
      start - start time of data to load
      end - end time of data to load
      Throws:
      IOException - if the all or some of the files cannot be read