diff --git a/src/main/java/com/github/prominence/openweathermap/api/annotation/SubscriptionAvailability.java b/src/main/java/com/github/prominence/openweathermap/api/annotation/SubscriptionAvailability.java index 61d365e..1e499aa 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/annotation/SubscriptionAvailability.java +++ b/src/main/java/com/github/prominence/openweathermap/api/annotation/SubscriptionAvailability.java @@ -29,6 +29,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Marker-type annotation to specify what type of license it needs to have to use API method. + */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.CLASS) public @interface SubscriptionAvailability { diff --git a/src/main/java/com/github/prominence/openweathermap/api/enums/Language.java b/src/main/java/com/github/prominence/openweathermap/api/enums/Language.java index c4ef6ce..df73bae 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/enums/Language.java +++ b/src/main/java/com/github/prominence/openweathermap/api/enums/Language.java @@ -22,8 +22,11 @@ package com.github.prominence.openweathermap.api.enums; +/** + * An enumeration which lists all available languages for API usage. + * Usually it could be specified to get response with some fields translated into desired language. + */ public enum Language { - ARABIC("ar"), BULGARIAN("bg"), CATALAN("ca"), diff --git a/src/main/java/com/github/prominence/openweathermap/api/enums/SubscriptionPlan.java b/src/main/java/com/github/prominence/openweathermap/api/enums/SubscriptionPlan.java index 46fd194..c70c4fa 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/enums/SubscriptionPlan.java +++ b/src/main/java/com/github/prominence/openweathermap/api/enums/SubscriptionPlan.java @@ -22,6 +22,10 @@ package com.github.prominence.openweathermap.api.enums; +/** + * An enumeration with all available subscription plans. + * More information at official website. + */ public enum SubscriptionPlan { FREE, STARTUP, diff --git a/src/main/java/com/github/prominence/openweathermap/api/enums/TimeFrame.java b/src/main/java/com/github/prominence/openweathermap/api/enums/TimeFrame.java index c133ef7..284bc5a 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/enums/TimeFrame.java +++ b/src/main/java/com/github/prominence/openweathermap/api/enums/TimeFrame.java @@ -22,6 +22,7 @@ package com.github.prominence.openweathermap.api.enums; +@Deprecated public enum TimeFrame { YEAR, MONTH, diff --git a/src/main/java/com/github/prominence/openweathermap/api/enums/UnitSystem.java b/src/main/java/com/github/prominence/openweathermap/api/enums/UnitSystem.java index 3457a1f..6387ed1 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/enums/UnitSystem.java +++ b/src/main/java/com/github/prominence/openweathermap/api/enums/UnitSystem.java @@ -22,8 +22,10 @@ package com.github.prominence.openweathermap.api.enums; +/** + * An enumeration for supported unit systems with helper methods. + */ public enum UnitSystem { - METRIC("metric"), IMPERIAL("imperial"), STANDARD("standard"); @@ -34,8 +36,8 @@ public enum UnitSystem { this.value = value; } - public static String getWindUnit(UnitSystem type) { - switch (type) { + public String getWindUnit() { + switch (this) { case IMPERIAL: return "miles/hour"; case STANDARD: @@ -45,8 +47,8 @@ public enum UnitSystem { } } - public static String getTemperatureUnit(UnitSystem type) { - switch (type) { + public String getTemperatureUnit() { + switch (this) { case METRIC: return "℃"; case IMPERIAL: diff --git a/src/main/java/com/github/prominence/openweathermap/api/exception/InvalidAuthTokenException.java b/src/main/java/com/github/prominence/openweathermap/api/exception/InvalidAuthTokenException.java index 9e7dd20..50640fa 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/exception/InvalidAuthTokenException.java +++ b/src/main/java/com/github/prominence/openweathermap/api/exception/InvalidAuthTokenException.java @@ -22,10 +22,13 @@ package com.github.prominence.openweathermap.api.exception; +/** + * An exception that could be thrown in case of your API key is invalid or your subscription plan does not cover requested functionality. + * Subscription plans information you can find here. + * API Keys could be checked in your profile. + */ public class InvalidAuthTokenException extends RuntimeException { - public InvalidAuthTokenException() { super("Authentication token wasn't set or requested functionality is not permitted for your subscription plan. Please, check https://home.openweathermap.org/api_keys/ and https://openweathermap.org/price."); } - } diff --git a/src/main/java/com/github/prominence/openweathermap/api/exception/NoDataFoundException.java b/src/main/java/com/github/prominence/openweathermap/api/exception/NoDataFoundException.java index 4f66b53..33a6593 100644 --- a/src/main/java/com/github/prominence/openweathermap/api/exception/NoDataFoundException.java +++ b/src/main/java/com/github/prominence/openweathermap/api/exception/NoDataFoundException.java @@ -22,8 +22,15 @@ package com.github.prominence.openweathermap.api.exception; +/** + * An exception that could be thrown in several cases: + *
InputStream instance containing http response body.
* @throws InvalidAuthTokenException in case if authentication token wasn't set or requested functionality is not permitted for its subscription plan.
* @throws NoDataFoundException 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.
*/
private static InputStream executeRequest(URL requestUrl) {
InputStream resultStream;