adapted class PlantListModel to PlantDatabase

#12
This commit is contained in:
schrom01
2022-10-24 19:00:06 +02:00
parent f9149c48fd
commit e5b5e1b88a
4 changed files with 57 additions and 23 deletions
@@ -56,9 +56,9 @@ public class JsonPlantDatabase implements PlantDatabase {
* @see PlantDatabase#getPlantById(long)
*/
@Override
public Optional<Plant> getPlantById(long id) throws HardinessZoneNotSetException, IOException {
public Optional<Plant> getPlantById(HardinessZone zone, long id) throws HardinessZoneNotSetException, IOException {
if (plantMap.isEmpty()) {
loadPlantList(currentZone);
loadPlantList(zone);
}
return Optional.ofNullable(plantMap.get(id));
}
@@ -30,5 +30,5 @@ public interface PlantDatabase {
* @throws IOException If the database cannot be accessed
* @throws HardinessZoneNotSetException If no {@link HardinessZone} was specified
*/
Optional<Plant> getPlantById(long id) throws IOException, HardinessZoneNotSetException;
Optional<Plant> getPlantById(HardinessZone zone, long id) throws IOException, HardinessZoneNotSetException;
}