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.thunder.ThunderProvider;
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.impl.openweathermap.OpenWeatherMapProvider;
@ -10,8 +12,8 @@ public class Providers {
public static ThunderProvider getThunderProvider(String name, String apiKey) throws NoSuchProviderException {
switch (name.toLowerCase()) {
case "blitzortung":
return new BlitzortungProvider();
case "blitzortung":
return new BlitzortungProvider();
}
throw new NoSuchProviderException();
@ -19,8 +21,17 @@ public class Providers {
public static WeatherProvider getWeatherProvider(String name, String apiKey) throws NoSuchProviderException {
switch (name.toLowerCase()) {
case "openweathermap":
return new OpenWeatherMapProvider(apiKey);
case "openweathermap":
return new OpenWeatherMapProvider(apiKey);
}
throw new NoSuchProviderException();
}
public static TwilightTimeProvider getTwilightTimeProvider(String name, String apiKey) throws NoSuchProviderException {
switch (name.toLowerCase()) {
case "approximate":
return new ApproximateTwilightTimeProvider();
}
throw new NoSuchProviderException();