From d9879d3be761c4908158d7688205fc34254bd136 Mon Sep 17 00:00:00 2001 From: Marcel <34819524+MarcelCoding@users.noreply.github.com> Date: Tue, 30 Mar 2021 15:06:27 +0200 Subject: [PATCH] Solved checkstyle violations --- .../main/java/com/github/marcelcoding/luna/dwd/Utils.java | 6 +++++- .../marcelcoding/luna/dwd/controller/WeatherController.java | 5 +++-- .../marcelcoding/luna/dwd/service/BrightSkyService.java | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/Utils.java b/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/Utils.java index 33e8706..a7eaa47 100644 --- a/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/Utils.java +++ b/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/Utils.java @@ -6,7 +6,11 @@ import reactor.core.publisher.Mono; @Slf4j -public class Utils { +public final class Utils { + + private Utils() { + throw new UnsupportedOperationException(); + } public static Mono handleError(final ClientResponse response, final Class clazz) { if (response.statusCode().equals(HttpStatus.OK)) { diff --git a/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/controller/WeatherController.java b/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/controller/WeatherController.java index 599cabd..c9e8ad9 100644 --- a/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/controller/WeatherController.java +++ b/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/controller/WeatherController.java @@ -1,7 +1,7 @@ package com.github.marcelcoding.luna.dwd.controller; import com.github.marcelcoding.luna.dwd.dto.CurrentWeatherResponse; -import com.github.marcelcoding.luna.dwd.dto.SourcesResponse; +import com.github.marcelcoding.luna.dwd.dto.Source; import com.github.marcelcoding.luna.dwd.dto.WeatherResponse; import com.github.marcelcoding.luna.dwd.service.BrightSkyService; import java.time.OffsetDateTime; @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @RestController @@ -39,7 +40,7 @@ public Mono currentWeather( } @GetMapping("stations") - public Mono stations( + public Flux stations( @RequestParam("lat") final float lat, @RequestParam("lon") final float lon, @RequestParam("radius") final int radius diff --git a/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/service/BrightSkyService.java b/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/service/BrightSkyService.java index 2d03dfd..2b62a1e 100644 --- a/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/service/BrightSkyService.java +++ b/luna-dwd/src/main/java/com/github/marcelcoding/luna/dwd/service/BrightSkyService.java @@ -76,7 +76,7 @@ public Mono weather(final float lat, final float lon) { * @param radius is meters ({@code m}) * @return a {@link Flux} with all matching {@link Source}s */ - public Mono sources(final float lat, final float lon, final int radius) { + public Flux sources(final float lat, final float lon, final int radius) { final QueryStringEncoder queryEncoder = new QueryStringEncoder("/sources"); queryEncoder.addParam("lat", String.valueOf(lat)); queryEncoder.addParam("lon", String.valueOf(lon)); @@ -85,7 +85,7 @@ public Mono sources(final float lat, final float lon, final int return this.client.get() .uri(queryEncoder.toString()) - .exchangeToMono(response -> Utils.handleError(response, SourcesResponse.class)); -// .flatMapIterable(SourcesResponse::getSources); + .exchangeToMono(response -> Utils.handleError(response, SourcesResponse.class)) + .flatMapIterable(SourcesResponse::getSources); } }