public abstract class AbstractWeatherData
extends java.lang.Object
CurrentWeatherData
and
ForecastWeatherData
classes. Standard
behaviors like the has
and the get
methods for
information about weather or forecast (for example, temperature, pressure,
weather, clouds, wind, etc.) are defined here.
Modifier and Type | Class and Description |
---|---|
static class |
AbstractWeatherData.Clouds
This class provides default implementations for
Clouds . |
static class |
AbstractWeatherData.Coord
This class provides default implementations for
Coord . |
static class |
AbstractWeatherData.Main
This class provides default implementations for
Main . |
static class |
AbstractWeatherData.Weather
This class provides default implementations for
Weather . |
static class |
AbstractWeatherData.Wind
This class provides default implementations for
Wind . |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
JSON_CLOUDS
Key for JSON object - Clouds
|
protected java.lang.String |
JSON_COORD
Key for JSON object - Coordinates (Geographic coordinates)
|
protected java.lang.String |
JSON_MAIN
Key for JSON object - Main (Temperature, pressure, etc.)
|
protected java.lang.String |
JSON_WEATHER
Key for JSON array - Weather (Weather name, description, etc.)
|
protected java.lang.String |
JSON_WIND
Key for JSON object - Wind
|
Constructor and Description |
---|
AbstractWeatherData()
Non-parameterized constructor
|
AbstractWeatherData(org.json.JSONObject jsonObj)
Parameterized constructor
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
getDateTime()
Returns data for date and time of this weather.
|
boolean |
hasDateTime()
Tells if the data for date and time of this weather is available or not.
|
protected final java.lang.String JSON_CLOUDS
protected final java.lang.String JSON_COORD
protected final java.lang.String JSON_MAIN
protected final java.lang.String JSON_WEATHER
protected final java.lang.String JSON_WIND
public AbstractWeatherData()
Initializes variables as per following basis:
Boolean: false
Integral: Minimum value (MIN_VALUE)
Floating point: Not a number (NaN)
Others: null
public AbstractWeatherData(org.json.JSONObject jsonObj)
Initializes variables from values from the given JSON object.
jsonObj
- JSON object containing weather datapublic boolean hasDateTime()
true
if data available, otherwise false
public java.util.Date getDateTime()
Date
) if available,
otherwise null