added enum for the weather interpretation type.
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
package com.mowesta.api.prediction;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An enumeration to represent different weather interpretation types.
|
||||
* The DWD uses an subset of WMO code table FM 94 BUFR/FM 95 CREX code table 0 20 003 – present weather.
|
||||
* see further at @https://www.dwd.de/DWD/forschung/nwv/fepub/icon_database_main.pdf, page 36.
|
||||
*
|
||||
* @author Sebastian, Tobias
|
||||
*/
|
||||
public enum WeatherInterpretationType {
|
||||
|
||||
UNKNOWN(-1),
|
||||
CLEAR_SKY(0),
|
||||
MAINLY_CLEAR(1),
|
||||
@@ -48,6 +57,13 @@ public enum WeatherInterpretationType {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value for the json representation.
|
||||
*
|
||||
* @param weatherInterpretationType The json number.
|
||||
* @return The weather interpretation type.
|
||||
*/
|
||||
@JsonCreator
|
||||
public static WeatherInterpretationType valueOf(int weatherInterpretationType) {
|
||||
if (!map.containsKey(weatherInterpretationType)) {
|
||||
return UNKNOWN;
|
||||
@@ -55,6 +71,12 @@ public enum WeatherInterpretationType {
|
||||
return (WeatherInterpretationType) map.get(weatherInterpretationType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the json representation.
|
||||
*
|
||||
* @return The json representation.
|
||||
*/
|
||||
@JsonValue
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user