public static class DailyForecastData.City
extends java.lang.Object
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 |
DailyForecastData.City.Coord
Parses data about geographic coordinates (from the JSON data)
and provides methods to get/access the information.
|
Modifier and Type | Field and Description |
---|---|
private long |
cityID
City code (ID)
|
private java.lang.String |
cityName
City name
|
private DailyForecastData.City.Coord |
coord |
private java.lang.String |
countryCode
Country code of city
|
private java.lang.String |
JSON_CITY_COORD
Key for JSON object - Coordinates
|
private java.lang.String |
JSON_CITY_COUNTRY_CODE
Key for JSON variable
Country code of city |
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_CITY_POPULATION
Key for JSON variable
Population of city |
private long |
population
Population of city
|
Constructor and Description |
---|
DailyForecastData.City()
Non-parameterized constructor
|
DailyForecastData.City(org.json.JSONObject jsonObj)
Parameterized constructor
Initializes variables from values from the given JSON object.
|
Modifier and Type | Method and Description |
---|---|
long |
getCityCode() |
java.lang.String |
getCityName() |
long |
getCityPopulation() |
DailyForecastData.City.Coord |
getCoordinates_Object() |
java.lang.String |
getCountryCode() |
boolean |
hasCityCode() |
boolean |
hasCityName() |
boolean |
hasCityPopulation() |
boolean |
hasCountryCode() |
private final java.lang.String JSON_CITY_COORD
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_CITY_COUNTRY_CODE
Country code of city
private final java.lang.String JSON_CITY_POPULATION
Population of city
private final long cityID
private final java.lang.String cityName
private final java.lang.String countryCode
private final long population
private final DailyForecastData.City.Coord coord
public DailyForecastData.City()
Initializes variables as per following basis:
Boolean: false
Integral: Minimum value (MIN_VALUE)
Floating point: Not a number (NaN)
Others: null
public DailyForecastData.City(org.json.JSONObject jsonObj)
jsonObj
- JSON object containing data about citypublic boolean hasCityCode()
public boolean hasCityName()
public boolean hasCountryCode()
public boolean hasCityPopulation()
public long getCityCode()
public java.lang.String getCityName()
public java.lang.String getCountryCode()
public long getCityPopulation()
public DailyForecastData.City.Coord getCoordinates_Object()