public class CurrentWeatherData extends AbstractWeatherData
has
and get
methods
to access the information.
has
methods can be used to check
if the data exists, i.e., if the data was available (successfully
downloaded) and was parsed correctly.
get
methods can be used to access the data, if the data
exists, otherwise get
methods will give value as per
following basis:
Boolean: false
Integral: Minimum value (MIN_VALUE)
Floating point: Not a number (NaN)
Others: null
Modifier and Type | Class and Description |
---|---|
static class |
CurrentWeatherData.Clouds
Parses data about clouds (from the JSON data) and provides methods
to get/access the information.
|
static class |
CurrentWeatherData.Coord
Parses data about geographic coordinates (from the JSON data)
and provides methods to get/access the information.
|
static class |
CurrentWeatherData.Main
Parses data about main weather elements (from the JSON data) and
provides methods to get/access the information.
|
static class |
CurrentWeatherData.Rain
Parses data about rain (from the JSON data) and provides methods
to get/access the information.
|
static class |
CurrentWeatherData.Sys
Parses data about country, sunrise, and sunset (from the JSON data)
and provides methods to get/access the information.
|
static class |
CurrentWeatherData.Weather
Parses data about weather code, name, etc.
|
static class |
CurrentWeatherData.Wind
Parses data about winds (from the JSON data) and provides methods
to get/access the information.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
base
Base
|
private long |
cityID
City code (ID)
|
private java.lang.String |
cityName
City name
|
private CurrentWeatherData.Clouds |
clouds |
private CurrentWeatherData.Coord |
coord |
private java.lang.String |
JSON_BASE
Key for JSON variable
Base |
private java.lang.String |
JSON_CITY_ID
Key for JSON variable
City code (ID) |
private java.lang.String |
JSON_CITY_NAME
Key for JSON variable
City name |
private java.lang.String |
JSON_RAIN
Key for JSON object - Rain
|
private java.lang.String |
JSON_RESPONSE_CODE
Key for JSON variable
Response code |
private java.lang.String |
JSON_SYS
Key for JSON object - Sys
|
private CurrentWeatherData.Main |
main |
private CurrentWeatherData.Rain |
rain |
private int |
responseCode
Response code
|
private CurrentWeatherData.Sys |
sys |
private java.util.List<CurrentWeatherData.Weather> |
weatherList
List of weather information (code, name, etc.)
|
private int |
weatherListCount
Count (number) of elements in list of weather information
|
private CurrentWeatherData.Wind |
wind |
JSON_CLOUDS, JSON_COORD, JSON_MAIN, JSON_WEATHER, JSON_WIND
Constructor and Description |
---|
CurrentWeatherData(org.json.JSONObject jsonObj)
Parameterized constructor
Initializes variables from values from the given JSON object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getBaseStation() |
long |
getCityCode() |
java.lang.String |
getCityName() |
CurrentWeatherData.Clouds |
getClouds_Object() |
CurrentWeatherData.Coord |
getCoordinates_Object() |
CurrentWeatherData.Main |
getMainData_Object() |
CurrentWeatherData.Rain |
getRain_Object() |
int |
getResponseCode() |
CurrentWeatherData.Sys |
getSysData_Object() |
int |
getWeather_List_Count() |
java.util.List<CurrentWeatherData.Weather> |
getWeather_List() |
CurrentWeatherData.Wind |
getWind_Object() |
boolean |
hasBaseStation() |
boolean |
hasCityCode() |
boolean |
hasCityName() |
boolean |
hasResponseCode() |
boolean |
hasWeather_List() |
getDateTime, hasDateTime
private final java.lang.String JSON_RAIN
private final java.lang.String JSON_SYS
private final java.lang.String JSON_BASE
Base
private final java.lang.String JSON_CITY_ID
City code (ID)
private final java.lang.String JSON_CITY_NAME
City name
private final java.lang.String JSON_RESPONSE_CODE
Response code
private final java.lang.String base
private final long cityID
private final java.lang.String cityName
private final int responseCode
private final CurrentWeatherData.Clouds clouds
private final CurrentWeatherData.Coord coord
private final CurrentWeatherData.Main main
private final CurrentWeatherData.Rain rain
private final CurrentWeatherData.Sys sys
private final CurrentWeatherData.Wind wind
private final java.util.List<CurrentWeatherData.Weather> weatherList
private final int weatherListCount
public CurrentWeatherData(org.json.JSONObject jsonObj)
jsonObj
- JSON object containing current weather datapublic boolean hasBaseStation()
public boolean hasCityCode()
public boolean hasCityName()
public boolean hasResponseCode()
public java.lang.String getBaseStation()
public long getCityCode()
public java.lang.String getCityName()
public int getResponseCode()
public CurrentWeatherData.Clouds getClouds_Object()
public CurrentWeatherData.Coord getCoordinates_Object()
public CurrentWeatherData.Main getMainData_Object()
public CurrentWeatherData.Rain getRain_Object()
public CurrentWeatherData.Sys getSysData_Object()
public CurrentWeatherData.Wind getWind_Object()
public boolean hasWeather_List()
public int getWeather_List_Count()
public java.util.List<CurrentWeatherData.Weather> getWeather_List()