Class FitnessAdapter

java.lang.Object
yearreview.app.data.sources.fitness.adapters.FitnessAdapter
Direct Known Subclasses:
StravaAdapter

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

    • database

      protected final FitnessDatabase database
      Database to insert the data into.
  • Constructor Details

    • FitnessAdapter

      public FitnessAdapter(FitnessDatabase database)
      Constructs a FitnessAdapter given a database to use for inserting the data
      Parameters:
      database - database to insert the data into
  • Method Details

    • getAdapter

      public static FitnessAdapter getAdapter(FitnessDatabase database, XmlNode config)
      Static function to get an adapter by its name
      Parameters:
      database - database to use for inserting the data
      config - configuration file for the adapter
      Returns:
      the adapter or null if an adapter with the given name does not exist
    • loadData

      public abstract void loadData(Instant start, Instant end) throws IOException
      Function that loads the data into the FitnessDatabase.
      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