Class WeatherAppApplication
java.lang.Object
gr.unipi.weather_app.WeatherAppApplication
The main entry point for the Weather Application.
This class is responsible for bootstrapping the Spring Boot application and providing a command-line interface (CLI) for interacting with the weather services.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
getAverageWeatherForCity
(Scanner scanner, WeatherService weatherService) Retrieves and displays the average weather data for a specified city.private void
getAverageWeatherForLastDays
(Scanner scanner, WeatherService weatherService) Retrieves and displays the average weather statistics for the last X days.private void
getWeatherData
(Scanner scanner, WeatherService weatherService) Fetches and displays real-time weather data for a specified city.static void
The main method that starts the Spring Boot application.(package private) org.springframework.boot.CommandLineRunner
runConsole
(WeatherService weatherService) Provides a command-line interface (CLI) for interacting with the weather application.
-
Constructor Details
-
WeatherAppApplication
public WeatherAppApplication()
-
-
Method Details
-
main
The main method that starts the Spring Boot application.- Parameters:
args
- command-line arguments (not used)
-
runConsole
Provides a command-line interface (CLI) for interacting with the weather application.Users can request weather data, fetch statistical reports, and exit the program.
- Parameters:
weatherService
- the service handling weather-related operations- Returns:
- a
CommandLineRunner
that executes the menu-driven interaction
-
getWeatherData
Fetches and displays real-time weather data for a specified city.- Parameters:
scanner
- theScanner
object to read user inputweatherService
- the service used to fetch weather data
-
getAverageWeatherForCity
Retrieves and displays the average weather data for a specified city.- Parameters:
scanner
- theScanner
object to read user inputweatherService
- the service used to retrieve weather statistics
-
getAverageWeatherForLastDays
Retrieves and displays the average weather statistics for the last X days.- Parameters:
scanner
- theScanner
object to read user inputweatherService
- the service used to retrieve historical weather data
-