import java.io.FileNotFoundException; import java.util.List; /** * Instances of this interface can be used to load weather data either from the API, or an XML file. * * @author Tommy F */ public interface IForecastLoader { /** * This method loads the weather forecast from the API. * * @return A list of forecast objects * @throws IllegalStateException if an error occurred and the data could not be fetched/parsed */ public List<IForecast> fetchWeather() throws IllegalStateException; /** * This method loads the weather forecast from an XML file. This is for backup only if the API * does not work. It requires an XML file with the same exact contents as the API response. * * @param filepathToXML path to the XML file relative to the executable * @return A list of forecast objects * @throws FileNotFoundException If the file given does not exist * @throws IllegalStateException if an error occurred and the data could not be parsed */ public List<IForecast> fetchWeatherXML(String filepathToXML) throws FileNotFoundException, IllegalStateException; }