Add getTwilightTimeProvider to providers by name

And fix eclipse indentation
This commit is contained in:
Minecon724 2024-09-24 18:40:35 +02:00
parent 31d6873249
commit 28286df814
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8

View file

@ -3,6 +3,8 @@ package eu.m724.wtapi.provider;
import eu.m724.wtapi.provider.exception.NoSuchProviderException; import eu.m724.wtapi.provider.exception.NoSuchProviderException;
import eu.m724.wtapi.provider.thunder.ThunderProvider; import eu.m724.wtapi.provider.thunder.ThunderProvider;
import eu.m724.wtapi.provider.thunder.impl.blitzortung.BlitzortungProvider; import eu.m724.wtapi.provider.thunder.impl.blitzortung.BlitzortungProvider;
import eu.m724.wtapi.provider.twilight.ApproximateTwilightTimeProvider;
import eu.m724.wtapi.provider.twilight.TwilightTimeProvider;
import eu.m724.wtapi.provider.weather.WeatherProvider; import eu.m724.wtapi.provider.weather.WeatherProvider;
import eu.m724.wtapi.provider.weather.impl.openweathermap.OpenWeatherMapProvider; import eu.m724.wtapi.provider.weather.impl.openweathermap.OpenWeatherMapProvider;
@ -26,4 +28,13 @@ public class Providers {
throw new NoSuchProviderException(); throw new NoSuchProviderException();
} }
public static TwilightTimeProvider getTwilightTimeProvider(String name, String apiKey) throws NoSuchProviderException {
switch (name.toLowerCase()) {
case "approximate":
return new ApproximateTwilightTimeProvider();
}
throw new NoSuchProviderException();
}
} }