The current version can run, but it must be poorly written.
List<? extends WeatherData> data = weatherReportDao.getCoviReportData(reportType);
WeatherENUM weatherENUM = WeatherENUM.valueOf(reportFunction);
switch (weatherENUM){
case atmosphere:
data = atmosphereReportDao.getAtmosphereReportData(reportType);
break;
case covi:
data = weatherReportDao.getCoviReportData(reportType);
break;
case windSpeed:
data = windSpeedReportDao.getWindSpeedReportData(reportType);
break;
}
return data;
The key is the initialization of data. If not initialized, an error will be reported. Ask for guidance.
Or find a way to pass a certain value of weatherENUM as a parameter to dao
If defined as a global variable, there is no need to initialize it.