diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/OpenWeatherMapClient.java b/src/main/java/com/github/prominence/openweathermap/api/request/OpenWeatherMapClient.java similarity index 90% rename from src/main/java/com/github/prominence/openweathermap/api/impl/OpenWeatherMapClient.java rename to src/main/java/com/github/prominence/openweathermap/api/request/OpenWeatherMapClient.java index f33f743..b920160 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/OpenWeatherMapClient.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/OpenWeatherMapClient.java @@ -20,7 +20,9 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request; + +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequesterImpl; public class OpenWeatherMapClient { diff --git a/src/main/java/com/github/prominence/openweathermap/api/RequestCustomizer.java b/src/main/java/com/github/prominence/openweathermap/api/request/RequestCustomizer.java similarity index 96% rename from src/main/java/com/github/prominence/openweathermap/api/RequestCustomizer.java rename to src/main/java/com/github/prominence/openweathermap/api/request/RequestCustomizer.java index eb55271..0768343 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/RequestCustomizer.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/RequestCustomizer.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request; import com.github.prominence.openweathermap.api.enums.Accuracy; import com.github.prominence.openweathermap.api.enums.Language; diff --git a/src/main/java/com/github/prominence/openweathermap/api/RequestTerminator.java b/src/main/java/com/github/prominence/openweathermap/api/request/RequestTerminator.java similarity index 95% rename from src/main/java/com/github/prominence/openweathermap/api/RequestTerminator.java rename to src/main/java/com/github/prominence/openweathermap/api/request/RequestTerminator.java index 10e91ad..95c6497 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/RequestTerminator.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/RequestTerminator.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request; public interface RequestTerminator { diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/RequestUrlBuilder.java b/src/main/java/com/github/prominence/openweathermap/api/request/RequestUrlBuilder.java similarity index 75% rename from src/main/java/com/github/prominence/openweathermap/api/impl/RequestUrlBuilder.java rename to src/main/java/com/github/prominence/openweathermap/api/request/RequestUrlBuilder.java index 34e4e28..f00dc3e 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/RequestUrlBuilder.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/RequestUrlBuilder.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request; import java.util.HashMap; import java.util.Map; @@ -28,14 +28,16 @@ import java.util.stream.Collectors; public class RequestUrlBuilder { - private StringBuilder builder = new StringBuilder(); - private Map requestParameters = new HashMap<>(); + private static final String API_KEY_PARAM_NAME = "appid"; - public RequestUrlBuilder(String baseUrl) { - builder.append(baseUrl); + private final StringBuilder builder = new StringBuilder("http://api.openweathermap.org/data/2.5/"); + private final Map requestParameters = new HashMap<>(); + + public RequestUrlBuilder(String key) { + requestParameters.put(API_KEY_PARAM_NAME, key); } - void append(String value) { + public void append(String value) { builder.append(value); } @@ -43,7 +45,11 @@ public class RequestUrlBuilder { requestParameters.put(key, value); } - String buildUrl() { + public void setAPIKey(String key) { + requestParameters.put(API_KEY_PARAM_NAME, key); + } + + public String buildUrl() { final String joinedParameters = requestParameters.entrySet().stream() .map(entry -> entry.getKey() + "=" + entry.getValue()) .collect(Collectors.joining("&")); diff --git a/src/main/java/com/github/prominence/openweathermap/api/ResponseMapper.java b/src/main/java/com/github/prominence/openweathermap/api/request/ResponseMapper.java similarity index 95% rename from src/main/java/com/github/prominence/openweathermap/api/ResponseMapper.java rename to src/main/java/com/github/prominence/openweathermap/api/request/ResponseMapper.java index 38ce552..3ed73b6 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/ResponseMapper.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/ResponseMapper.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request; import java.util.List; diff --git a/src/main/java/com/github/prominence/openweathermap/api/CurrentWeatherRequestTerminator.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequestTerminator.java similarity index 89% rename from src/main/java/com/github/prominence/openweathermap/api/CurrentWeatherRequestTerminator.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequestTerminator.java index 11d4339..f9457fe 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/CurrentWeatherRequestTerminator.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequestTerminator.java @@ -20,7 +20,9 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather; + +import com.github.prominence.openweathermap.api.request.RequestTerminator; public interface CurrentWeatherRequestTerminator extends RequestTerminator { diff --git a/src/main/java/com/github/prominence/openweathermap/api/CurrentWeatherRequester.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequester.java similarity index 81% rename from src/main/java/com/github/prominence/openweathermap/api/CurrentWeatherRequester.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequester.java index d9f7467..04169a9 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/CurrentWeatherRequester.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequester.java @@ -20,7 +20,10 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather; + +import com.github.prominence.openweathermap.api.request.weather.multiple.MultipleLocationsWeatherRequester; +import com.github.prominence.openweathermap.api.request.weather.single.SingleLocationWeatherRequester; public interface CurrentWeatherRequester { diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/CurrentWeatherRequesterImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequesterImpl.java similarity index 66% rename from src/main/java/com/github/prominence/openweathermap/api/impl/CurrentWeatherRequesterImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequesterImpl.java index 31ee121..2c445ab 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/CurrentWeatherRequesterImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherRequesterImpl.java @@ -20,18 +20,20 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather; -import com.github.prominence.openweathermap.api.CurrentWeatherRequester; -import com.github.prominence.openweathermap.api.MultipleLocationsWeatherRequester; -import com.github.prominence.openweathermap.api.SingleLocationWeatherRequester; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; +import com.github.prominence.openweathermap.api.request.weather.multiple.MultipleLocationsCurrentWeatherRequesterImpl; +import com.github.prominence.openweathermap.api.request.weather.multiple.MultipleLocationsWeatherRequester; +import com.github.prominence.openweathermap.api.request.weather.single.SingleLocationCurrentWeatherRequesterImpl; +import com.github.prominence.openweathermap.api.request.weather.single.SingleLocationWeatherRequester; public class CurrentWeatherRequesterImpl implements CurrentWeatherRequester { - private RequestUrlBuilder urlBuilder = new RequestUrlBuilder("http://api.openweathermap.org/data/2.5/"); + private final RequestUrlBuilder urlBuilder; - CurrentWeatherRequesterImpl(String apiKey) { - urlBuilder.addRequestParameter("appid", apiKey); + public CurrentWeatherRequesterImpl(String apiKey) { + urlBuilder = new RequestUrlBuilder(apiKey); } public SingleLocationWeatherRequester single() { diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/CurrentWeatherResponseMapper.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherResponseMapper.java similarity index 97% rename from src/main/java/com/github/prominence/openweathermap/api/impl/CurrentWeatherResponseMapper.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherResponseMapper.java index 0af4674..a7c7275 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/CurrentWeatherResponseMapper.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/CurrentWeatherResponseMapper.java @@ -20,11 +20,11 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.prominence.openweathermap.api.ResponseMapper; +import com.github.prominence.openweathermap.api.request.ResponseMapper; import com.github.prominence.openweathermap.api.enums.UnitSystem; import com.github.prominence.openweathermap.api.model.*; @@ -81,9 +81,9 @@ import java.util.TimeZone; */ public class CurrentWeatherResponseMapper implements ResponseMapper { - private UnitSystem unitSystem; + private final UnitSystem unitSystem; - CurrentWeatherResponseMapper(UnitSystem unitSystem) { + public CurrentWeatherResponseMapper(UnitSystem unitSystem) { this.unitSystem = unitSystem != null ? unitSystem : UnitSystem.STANDARD; } diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/MultipleLocationsCurrentWeatherRequesterImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleLocationsCurrentWeatherRequesterImpl.java similarity index 90% rename from src/main/java/com/github/prominence/openweathermap/api/impl/MultipleLocationsCurrentWeatherRequesterImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleLocationsCurrentWeatherRequesterImpl.java index 72597b8..46e2121 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/MultipleLocationsCurrentWeatherRequesterImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleLocationsCurrentWeatherRequesterImpl.java @@ -20,18 +20,17 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather.multiple; -import com.github.prominence.openweathermap.api.MultipleLocationsWeatherRequester; -import com.github.prominence.openweathermap.api.MultipleResultCurrentWeatherRequestCustomizer; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; import com.github.prominence.openweathermap.api.model.Coordinate; import com.github.prominence.openweathermap.api.model.CoordinateRectangle; public class MultipleLocationsCurrentWeatherRequesterImpl implements MultipleLocationsWeatherRequester { - private RequestUrlBuilder urlBuilder; + private final RequestUrlBuilder urlBuilder; - MultipleLocationsCurrentWeatherRequesterImpl(RequestUrlBuilder urlBuilder) { + public MultipleLocationsCurrentWeatherRequesterImpl(RequestUrlBuilder urlBuilder) { this.urlBuilder = urlBuilder; } diff --git a/src/main/java/com/github/prominence/openweathermap/api/MultipleLocationsWeatherRequester.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleLocationsWeatherRequester.java similarity index 95% rename from src/main/java/com/github/prominence/openweathermap/api/MultipleLocationsWeatherRequester.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleLocationsWeatherRequester.java index 5a24828..002a8df 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/MultipleLocationsWeatherRequester.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleLocationsWeatherRequester.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather.multiple; import com.github.prominence.openweathermap.api.model.Coordinate; import com.github.prominence.openweathermap.api.model.CoordinateRectangle; diff --git a/src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherAsyncRequestTerminator.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherAsyncRequestTerminator.java similarity index 89% rename from src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherAsyncRequestTerminator.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherAsyncRequestTerminator.java index 35a1d1f..13febcb 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherAsyncRequestTerminator.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherAsyncRequestTerminator.java @@ -20,9 +20,10 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather.multiple; import com.github.prominence.openweathermap.api.model.Weather; +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequestTerminator; import java.util.List; import java.util.concurrent.CompletableFuture; diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherAsyncRequestTerminatorImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherAsyncRequestTerminatorImpl.java similarity index 88% rename from src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherAsyncRequestTerminatorImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherAsyncRequestTerminatorImpl.java index a66dd90..25c1175 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherAsyncRequestTerminatorImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherAsyncRequestTerminatorImpl.java @@ -20,9 +20,10 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather.multiple; -import com.github.prominence.openweathermap.api.MultipleResultCurrentWeatherAsyncRequestTerminator; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherResponseMapper; import com.github.prominence.openweathermap.api.enums.UnitSystem; import com.github.prominence.openweathermap.api.model.Weather; import com.github.prominence.openweathermap.api.utils.RequestUtils; @@ -32,8 +33,8 @@ import java.util.concurrent.CompletableFuture; public class MultipleResultCurrentWeatherAsyncRequestTerminatorImpl implements MultipleResultCurrentWeatherAsyncRequestTerminator { - private RequestUrlBuilder urlBuilder; - private UnitSystem unitSystem; + private final RequestUrlBuilder urlBuilder; + private final UnitSystem unitSystem; MultipleResultCurrentWeatherAsyncRequestTerminatorImpl(RequestUrlBuilder urlBuilder, UnitSystem unitSystem) { this.urlBuilder = urlBuilder; diff --git a/src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherRequestCustomizer.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestCustomizer.java similarity index 90% rename from src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherRequestCustomizer.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestCustomizer.java index 5560a73..fc3552b 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherRequestCustomizer.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestCustomizer.java @@ -20,7 +20,9 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather.multiple; + +import com.github.prominence.openweathermap.api.request.RequestCustomizer; public interface MultipleResultCurrentWeatherRequestCustomizer extends RequestCustomizer { diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherRequestCustomizerImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestCustomizerImpl.java similarity index 88% rename from src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherRequestCustomizerImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestCustomizerImpl.java index 1b0a243..5d577bb 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherRequestCustomizerImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestCustomizerImpl.java @@ -20,18 +20,16 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather.multiple; -import com.github.prominence.openweathermap.api.MultipleResultCurrentWeatherAsyncRequestTerminator; -import com.github.prominence.openweathermap.api.MultipleResultCurrentWeatherRequestCustomizer; -import com.github.prominence.openweathermap.api.MultipleResultCurrentWeatherRequestTerminator; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; import com.github.prominence.openweathermap.api.enums.Accuracy; import com.github.prominence.openweathermap.api.enums.Language; import com.github.prominence.openweathermap.api.enums.UnitSystem; public class MultipleResultCurrentWeatherRequestCustomizerImpl implements MultipleResultCurrentWeatherRequestCustomizer { - private RequestUrlBuilder urlBuilder; + private final RequestUrlBuilder urlBuilder; private Accuracy accuracy; private Language language; diff --git a/src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherRequestTerminator.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestTerminator.java similarity index 88% rename from src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherRequestTerminator.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestTerminator.java index 2cc71aa..ad0ae4e 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/MultipleResultCurrentWeatherRequestTerminator.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestTerminator.java @@ -20,9 +20,10 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather.multiple; import com.github.prominence.openweathermap.api.model.Weather; +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequestTerminator; import java.util.List; diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherRequestTerminatorImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestTerminatorImpl.java similarity index 87% rename from src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherRequestTerminatorImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestTerminatorImpl.java index daca10d..9889a85 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/MultipleResultCurrentWeatherRequestTerminatorImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/multiple/MultipleResultCurrentWeatherRequestTerminatorImpl.java @@ -20,9 +20,10 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather.multiple; -import com.github.prominence.openweathermap.api.MultipleResultCurrentWeatherRequestTerminator; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherResponseMapper; import com.github.prominence.openweathermap.api.enums.UnitSystem; import com.github.prominence.openweathermap.api.model.Weather; import com.github.prominence.openweathermap.api.utils.RequestUtils; @@ -31,8 +32,8 @@ import java.util.List; public class MultipleResultCurrentWeatherRequestTerminatorImpl implements MultipleResultCurrentWeatherRequestTerminator { - private RequestUrlBuilder urlBuilder; - private UnitSystem unitSystem; + private final RequestUrlBuilder urlBuilder; + private final UnitSystem unitSystem; MultipleResultCurrentWeatherRequestTerminatorImpl(RequestUrlBuilder urlBuilder, UnitSystem unitSystem) { this.urlBuilder = urlBuilder; diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/SingleLocationCurrentWeatherRequesterImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleLocationCurrentWeatherRequesterImpl.java similarity index 90% rename from src/main/java/com/github/prominence/openweathermap/api/impl/SingleLocationCurrentWeatherRequesterImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleLocationCurrentWeatherRequesterImpl.java index 8ff61ba..a95c6ad 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/SingleLocationCurrentWeatherRequesterImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleLocationCurrentWeatherRequesterImpl.java @@ -20,16 +20,16 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather.single; -import com.github.prominence.openweathermap.api.SingleLocationWeatherRequester; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; import com.github.prominence.openweathermap.api.model.Coordinate; public class SingleLocationCurrentWeatherRequesterImpl implements SingleLocationWeatherRequester { - private RequestUrlBuilder urlBuilder; + private final RequestUrlBuilder urlBuilder; - SingleLocationCurrentWeatherRequesterImpl(RequestUrlBuilder urlBuilder) { + public SingleLocationCurrentWeatherRequesterImpl(RequestUrlBuilder urlBuilder) { this.urlBuilder = urlBuilder; urlBuilder.append("weather"); } diff --git a/src/main/java/com/github/prominence/openweathermap/api/SingleLocationWeatherRequester.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleLocationWeatherRequester.java similarity index 95% rename from src/main/java/com/github/prominence/openweathermap/api/SingleLocationWeatherRequester.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleLocationWeatherRequester.java index 15c9666..6812f25 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/SingleLocationWeatherRequester.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleLocationWeatherRequester.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather.single; import com.github.prominence.openweathermap.api.model.Coordinate; diff --git a/src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherAsyncRequestTerminator.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherAsyncRequestTerminator.java similarity index 89% rename from src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherAsyncRequestTerminator.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherAsyncRequestTerminator.java index 491cb12..a44b1cc 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherAsyncRequestTerminator.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherAsyncRequestTerminator.java @@ -20,9 +20,10 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather.single; import com.github.prominence.openweathermap.api.model.Weather; +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequestTerminator; import java.util.concurrent.CompletableFuture; diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherAsyncRequestTerminatorImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherAsyncRequestTerminatorImpl.java similarity index 88% rename from src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherAsyncRequestTerminatorImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherAsyncRequestTerminatorImpl.java index b90bd27..7206820 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherAsyncRequestTerminatorImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherAsyncRequestTerminatorImpl.java @@ -20,9 +20,10 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather.single; -import com.github.prominence.openweathermap.api.SingleResultCurrentWeatherAsyncRequestTerminator; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherResponseMapper; import com.github.prominence.openweathermap.api.enums.UnitSystem; import com.github.prominence.openweathermap.api.model.Weather; import com.github.prominence.openweathermap.api.utils.RequestUtils; @@ -31,8 +32,8 @@ import java.util.concurrent.CompletableFuture; public class SingleResultCurrentWeatherAsyncRequestTerminatorImpl implements SingleResultCurrentWeatherAsyncRequestTerminator { - private RequestUrlBuilder urlBuilder; - private UnitSystem unitSystem; + private final RequestUrlBuilder urlBuilder; + private final UnitSystem unitSystem; SingleResultCurrentWeatherAsyncRequestTerminatorImpl(RequestUrlBuilder urlBuilder, UnitSystem unitSystem) { this.urlBuilder = urlBuilder; diff --git a/src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherRequestCustomizer.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestCustomizer.java similarity index 90% rename from src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherRequestCustomizer.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestCustomizer.java index 8e071c1..60ffe7a 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherRequestCustomizer.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestCustomizer.java @@ -20,7 +20,9 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather.single; + +import com.github.prominence.openweathermap.api.request.RequestCustomizer; public interface SingleResultCurrentWeatherRequestCustomizer extends RequestCustomizer { diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherRequestCustomizerImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestCustomizerImpl.java similarity index 88% rename from src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherRequestCustomizerImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestCustomizerImpl.java index b4ad417..5aceadd 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherRequestCustomizerImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestCustomizerImpl.java @@ -20,18 +20,16 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather.single; -import com.github.prominence.openweathermap.api.SingleResultCurrentWeatherAsyncRequestTerminator; -import com.github.prominence.openweathermap.api.SingleResultCurrentWeatherRequestCustomizer; -import com.github.prominence.openweathermap.api.SingleResultCurrentWeatherRequestTerminator; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; import com.github.prominence.openweathermap.api.enums.Accuracy; import com.github.prominence.openweathermap.api.enums.Language; import com.github.prominence.openweathermap.api.enums.UnitSystem; public class SingleResultCurrentWeatherRequestCustomizerImpl implements SingleResultCurrentWeatherRequestCustomizer { - private RequestUrlBuilder urlBuilder; + private final RequestUrlBuilder urlBuilder; private Accuracy accuracy; private Language language; diff --git a/src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherRequestTerminator.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestTerminator.java similarity index 88% rename from src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherRequestTerminator.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestTerminator.java index ed0ef73..5834cef 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/SingleResultCurrentWeatherRequestTerminator.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestTerminator.java @@ -20,9 +20,10 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api; +package com.github.prominence.openweathermap.api.request.weather.single; import com.github.prominence.openweathermap.api.model.Weather; +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequestTerminator; public interface SingleResultCurrentWeatherRequestTerminator extends CurrentWeatherRequestTerminator { } diff --git a/src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherRequestTerminatorImpl.java b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestTerminatorImpl.java similarity index 87% rename from src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherRequestTerminatorImpl.java rename to src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestTerminatorImpl.java index 9c93db2..9f5bc80 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/impl/SingleResultCurrentWeatherRequestTerminatorImpl.java +++ b/src/main/java/com/github/prominence/openweathermap/api/request/weather/single/SingleResultCurrentWeatherRequestTerminatorImpl.java @@ -20,17 +20,18 @@ * SOFTWARE. */ -package com.github.prominence.openweathermap.api.impl; +package com.github.prominence.openweathermap.api.request.weather.single; -import com.github.prominence.openweathermap.api.SingleResultCurrentWeatherRequestTerminator; +import com.github.prominence.openweathermap.api.request.RequestUrlBuilder; +import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherResponseMapper; import com.github.prominence.openweathermap.api.enums.UnitSystem; import com.github.prominence.openweathermap.api.model.Weather; import com.github.prominence.openweathermap.api.utils.RequestUtils; public class SingleResultCurrentWeatherRequestTerminatorImpl implements SingleResultCurrentWeatherRequestTerminator { - private RequestUrlBuilder urlBuilder; - private UnitSystem unitSystem; + private final RequestUrlBuilder urlBuilder; + private final UnitSystem unitSystem; SingleResultCurrentWeatherRequestTerminatorImpl(RequestUrlBuilder urlBuilder, UnitSystem unitSystem) { this.urlBuilder = urlBuilder; diff --git a/src/test/java/com/github/prominence/openweathermap/api/ApiTest.java b/src/test/java/com/github/prominence/openweathermap/api/ApiTest.java index 443431e..8f66ebd 100644 --- a/src/test/java/com/github/prominence/openweathermap/api/ApiTest.java +++ b/src/test/java/com/github/prominence/openweathermap/api/ApiTest.java @@ -22,7 +22,7 @@ package com.github.prominence.openweathermap.api; -import com.github.prominence.openweathermap.api.impl.OpenWeatherMapClient; +import com.github.prominence.openweathermap.api.request.OpenWeatherMapClient; import org.junit.BeforeClass; public class ApiTest { diff --git a/src/test/java/com/github/prominence/openweathermap/api/CurrentWeatherIntegrationTest.java b/src/test/java/com/github/prominence/openweathermap/api/CurrentWeatherIntegrationTest.java index b540f50..86aae0f 100644 --- a/src/test/java/com/github/prominence/openweathermap/api/CurrentWeatherIntegrationTest.java +++ b/src/test/java/com/github/prominence/openweathermap/api/CurrentWeatherIntegrationTest.java @@ -27,7 +27,7 @@ import com.github.prominence.openweathermap.api.enums.Language; import com.github.prominence.openweathermap.api.enums.UnitSystem; import com.github.prominence.openweathermap.api.exception.NoDataFoundException; import com.github.prominence.openweathermap.api.exception.InvalidAuthTokenException; -import com.github.prominence.openweathermap.api.impl.OpenWeatherMapClient; +import com.github.prominence.openweathermap.api.request.OpenWeatherMapClient; import com.github.prominence.openweathermap.api.model.Coordinate; import com.github.prominence.openweathermap.api.model.CoordinateRectangle; import com.github.prominence.openweathermap.api.model.Weather;