|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.degreedays.api.Response
net.degreedays.api.data.LocationDataResponse
public final class LocationDataResponse
Contains the degree-day data generated to fulfil a
LocationDataRequest
.
DataApi.getLocationData(LocationDataRequest)
Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.
Nested Class Summary | |
---|---|
static class |
LocationDataResponse.Builder
A builder class for creating immutable LocationDataResponse
objects e.g. for testing purposes. |
Method Summary | |
---|---|
DataSets |
dataSets()
Returns the non-null DataSets object containing the sets of
data generated to fulfil the DataSpecs from the
LocationDataRequest that led to this response. |
boolean |
equals(java.lang.Object o)
Returns true if o is a
LocationDataResponse with equal values for everything
apart from the metadata() (which is not
considered in the equality test). |
Source[] |
getSources()
Returns the non-null, non-empty array of source(s) (essentially weather stations) that were used to generate the data in this response. |
int |
hashCode()
Overridden to ensure consistency with equals . |
java.lang.String |
stationId()
Returns the non-null, non-empty canonical ID of the weather station or combination of weather stations that supplied the temperature data used to calculate the returned degree days. |
LongLat |
targetLongLat()
Returns the non-null LongLat object that specifies the
geographic position of the Location from the
LocationDataRequest that led to this response. |
java.lang.String |
toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes. |
Methods inherited from class net.degreedays.api.Response |
---|
metadata |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.lang.String stationId()
If the Location
in the LocationDataRequest
was a
StationIdLocation
, this method will simply return the canonical
form of that weather station's ID. We say "canonical" because it's
possible for a station ID to be expressed in more than one way, like
upper case or lower case. The canonical form of the station ID is the
form that you should display in a UI or store in a database if
appropriate.
If the Location
in the LocationDataRequest
was
a GeographicLocation
, then:
Either way, the station ID returned by this method can be used to fetch
more data from the same station(s) that were used to generate the data in
this response. For example, you might want to request data using a
GeographicLocation
initially, and then use the returned
station ID to fetch updates each day, week, or month going forward.
public LongLat targetLongLat()
LongLat
object that specifies the
geographic position of the Location
from the
LocationDataRequest
that led to this response.
If the Location
from the request was a
PostalCodeLocation
then this will
return the LongLat
that the API determined to be the central
point of that postal code.
If the Location
from the request was a
StationIdLocation
then this will return the LongLat
of that station (also accessible through getSources()
).
If the Location
from the request was a
LongLatLocation
then this will
simply return the LongLat
that was originally specified.
(Bear in mind that the longitude and latitude may have been rounded
slightly between the request and the response. Such rounding would only
introduce very small differences that would be insignificant as far as
the real-world position is concerned, but it's worth bearing this in mind
in case you are comparing for equality the returned LongLat
with the LongLat
from the request. The two positions will be
close, but they might not be equal.)
public Source[] getSources()
At the time of writing there will only be one source for any given
response (so getSources()[0]
is the way to get it)... But at
some point we might start combining data from multiple sources to satisfy
requests for data from geographic
locations. If we do add this feature, it will be optional, and disabled
by default, so the behaviour of your system won't change unless you want
it to.
The returned array can be modified freely without affecting the
immutability of this LocationDataResponse
or the arrays
returned by past, concurrent, or future calls to this method.
public DataSets dataSets()
DataSets
object containing the sets of
data generated to fulfil the DataSpecs
from the
LocationDataRequest
that led to this response.
public boolean equals(java.lang.Object o)
true
if o
is a
LocationDataResponse
with equal values for everything
apart from the metadata()
(which is not
considered in the equality test).
equals
in class java.lang.Object
public int hashCode()
equals
.
hashCode
in class java.lang.Object
public java.lang.String toString()
The exact details of the representation are unspecified and subject to change.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |