mirror of
https://github.com/Prominence/openweathermap-java-api.git
synced 2026-01-10 11:56:44 +03:00
Fixed docs. Removed 'annotations' dependency.
This commit is contained in:
parent
d3ca16472b
commit
babc48bf6c
@ -258,9 +258,9 @@ Available requests:
|
|||||||
| `getHumidity()` | Returns *humidity* percentage information. |
|
| `getHumidity()` | Returns *humidity* percentage information. |
|
||||||
| `getWindSpeed()` | Returns wind's speed. |
|
| `getWindSpeed()` | Returns wind's speed. |
|
||||||
| `getWindDegrees()` | Returns wind's degree. |
|
| `getWindDegrees()` | Returns wind's degree. |
|
||||||
| `getWindUnit()` | Returns wind's unitSystem. |
|
| `getWindUnit()` | Returns wind's unit. |
|
||||||
| `getPressure()` | Returns pressure value. |
|
| `getPressure()` | Returns pressure value. |
|
||||||
| `getPressureUnit()` | Returns pressure's unitSystem. |
|
| `getPressureUnit()` | Returns pressure's unit. |
|
||||||
| `toString()` | Returns pretty string for the whole available forecast information. |
|
| `toString()` | Returns pretty string for the whole available forecast information. |
|
||||||
|
|
||||||
#### UV Index
|
#### UV Index
|
||||||
|
|||||||
@ -258,9 +258,9 @@ Available requests:
|
|||||||
| `getHumidity()` | Returns *humidity* percentage information. |
|
| `getHumidity()` | Returns *humidity* percentage information. |
|
||||||
| `getWindSpeed()` | Returns wind's speed. |
|
| `getWindSpeed()` | Returns wind's speed. |
|
||||||
| `getWindDegrees()` | Returns wind's degree. |
|
| `getWindDegrees()` | Returns wind's degree. |
|
||||||
| `getWindUnit()` | Returns wind's unitSystem. |
|
| `getWindUnit()` | Returns wind's unit. |
|
||||||
| `getPressure()` | Returns pressure value. |
|
| `getPressure()` | Returns pressure value. |
|
||||||
| `getPressureUnit()` | Returns pressure's unitSystem. |
|
| `getPressureUnit()` | Returns pressure's unit. |
|
||||||
| `toString()` | Returns pretty string for the whole available forecast information. |
|
| `toString()` | Returns pretty string for the whole available forecast information. |
|
||||||
|
|
||||||
#### UV Index
|
#### UV Index
|
||||||
|
|||||||
@ -171,5 +171,4 @@ Location: Minsk(BY), Weather: слегка облачно, 20.0 ℃, 1019.0 hPa,
|
|||||||
### Dependencies
|
### Dependencies
|
||||||
* com.fasterxml.jackson.core:jackson-databind:2.9.9
|
* com.fasterxml.jackson.core:jackson-databind:2.9.9
|
||||||
* org.slf4j:slf4j-api:1.7.26 (*compile*)
|
* org.slf4j:slf4j-api:1.7.26 (*compile*)
|
||||||
* org.jetbrains:annotations:17.0.0 (*compile*)
|
|
||||||
* junit:junit:4.12 (*test*)
|
* junit:junit:4.12 (*test*)
|
||||||
6
pom.xml
6
pom.xml
@ -165,12 +165,6 @@
|
|||||||
<version>1.7.26</version>
|
<version>1.7.26</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<version>17.0.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
|||||||
@ -40,41 +40,41 @@ import java.util.TimeZone;
|
|||||||
* Official API response documentation:
|
* Official API response documentation:
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* --- coord
|
* --- coord
|
||||||
* |- coord.lon City geo location, longitude
|
* |- coord.lon City geo location, longitude
|
||||||
* |- coord.lat City geo location, latitude
|
* |- coord.lat City geo location, latitude
|
||||||
* --- weather (more info Weather condition codes)
|
* --- weather (more info Weather condition codes)
|
||||||
* |- weather.id Weather condition id
|
* |- weather.id Weather condition id
|
||||||
* |- weather.main Group of weather parameters (Rain, Snow, Extreme etc.)
|
* |- weather.main Group of weather parameters (Rain, Snow, Extreme etc.)
|
||||||
* |- weather.description Weather condition within the group
|
* |- weather.description Weather condition within the group
|
||||||
* |- weather.icon Weather icon id
|
* |- weather.icon Weather icon id
|
||||||
* --- base Internal parameter
|
* --- base Internal parameter
|
||||||
* --- main
|
* --- main
|
||||||
* |- main.temp Temperature. UnitSystem Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
|
* |- main.temp Temperature. UnitSystem Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
|
||||||
* |- main.pressure Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa
|
* |- main.pressure Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa
|
||||||
* |- main.humidity Humidity, %
|
* |- main.humidity Humidity, %
|
||||||
* |- main.temp_min Minimum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). UnitSystem Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
|
* |- main.temp_min Minimum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). UnitSystem Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
|
||||||
* |- main.temp_max Maximum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). UnitSystem Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
|
* |- main.temp_max Maximum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). UnitSystem Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
|
||||||
* |- main.sea_level Atmospheric pressure on the sea level, hPa
|
* |- main.sea_level Atmospheric pressure on the sea level, hPa
|
||||||
* |- main.grnd_level Atmospheric pressure on the ground level, hPa
|
* |- main.grnd_level Atmospheric pressure on the ground level, hPa
|
||||||
* --- wind
|
* --- wind
|
||||||
* |- wind.speed Wind speed. UnitSystem Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.
|
* |- wind.speed Wind speed. UnitSystem Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.
|
||||||
* |- wind.deg Wind direction, degrees (meteorological)
|
* |- wind.deg Wind direction, degrees (meteorological)
|
||||||
* --- clouds
|
* --- clouds
|
||||||
* |- clouds.all Cloudiness, %
|
* |- clouds.all Cloudiness, %
|
||||||
* --- rain
|
* --- rain
|
||||||
* |- rain.1h Rain volume for the last 1 hour, mm
|
* |- rain.1h Rain volume for the last 1 hour, mm
|
||||||
* |- rain.3h Rain volume for the last 3 hours, mm
|
* |- rain.3h Rain volume for the last 3 hours, mm
|
||||||
* --- snow
|
* --- snow
|
||||||
* |- snow.1h Snow volume for the last 1 hour, mm
|
* |- snow.1h Snow volume for the last 1 hour, mm
|
||||||
* |- snow.3h Snow volume for the last 3 hours, mm
|
* |- snow.3h Snow volume for the last 3 hours, mm
|
||||||
* --- dt Time of data calculation, unix, UTC
|
* --- dt Time of data calculation, unix, UTC
|
||||||
* --- sys
|
* --- sys
|
||||||
* |- sys.type Internal parameter
|
* |- sys.type Internal parameter
|
||||||
* |- sys.id Internal parameter
|
* |- sys.id Internal parameter
|
||||||
* |- sys.message Internal parameter
|
* |- sys.message Internal parameter
|
||||||
* |- sys.country Country code (GB, JP etc.)
|
* |- sys.country Country code (GB, JP etc.)
|
||||||
* |- sys.sunrise Sunrise time, unix, UTC
|
* |- sys.sunrise Sunrise time, unix, UTC
|
||||||
* |- sys.sunset Sunset time, unix, UTC
|
* |- sys.sunset Sunset time, unix, UTC
|
||||||
* --- id City ID
|
* --- id City ID
|
||||||
* --- name City name
|
* --- name City name
|
||||||
* --- cod Internal parameter
|
* --- cod Internal parameter
|
||||||
|
|||||||
@ -24,7 +24,6 @@ package com.github.prominence.openweathermap.api.utils;
|
|||||||
|
|
||||||
import com.github.prominence.openweathermap.api.exception.DataNotFoundException;
|
import com.github.prominence.openweathermap.api.exception.DataNotFoundException;
|
||||||
import com.github.prominence.openweathermap.api.exception.InvalidAuthTokenException;
|
import com.github.prominence.openweathermap.api.exception.InvalidAuthTokenException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -56,8 +55,7 @@ public final class RequestUtils {
|
|||||||
* @throws DataNotFoundException in case if there is no any data for requested location(s) or request is invalid.
|
* @throws DataNotFoundException in case if there is no any data for requested location(s) or request is invalid.
|
||||||
* @throws IllegalStateException in case of unexpected response or error.
|
* @throws IllegalStateException in case of unexpected response or error.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private static InputStream executeRequest(URL requestUrl) {
|
||||||
private static InputStream executeRequest(@NotNull URL requestUrl) {
|
|
||||||
InputStream resultStream;
|
InputStream resultStream;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -91,8 +89,7 @@ public final class RequestUtils {
|
|||||||
* @return response from the request in <code>String</code> representation.
|
* @return response from the request in <code>String</code> representation.
|
||||||
* @throws IllegalArgumentException in case if provided parameter isn't a valid url for {@link URL} instance.
|
* @throws IllegalArgumentException in case if provided parameter isn't a valid url for {@link URL} instance.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public static String getResponse(String url) {
|
||||||
public static String getResponse(@NotNull String url) {
|
|
||||||
URL requestUrl;
|
URL requestUrl;
|
||||||
try {
|
try {
|
||||||
requestUrl = new URL(url);
|
requestUrl = new URL(url);
|
||||||
@ -112,8 +109,7 @@ public final class RequestUtils {
|
|||||||
* @return converted <code>InputStream</code> content.
|
* @return converted <code>InputStream</code> content.
|
||||||
* @throws IllegalArgumentException in case if input stream is unable to be read.
|
* @throws IllegalArgumentException in case if input stream is unable to be read.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private static String convertInputStreamToString(InputStream inputStream) {
|
||||||
private static String convertInputStreamToString(@NotNull InputStream inputStream) {
|
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
|
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user